forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_term.html.erb
More file actions
109 lines (109 loc) · 5.98 KB
/
Copy path_term.html.erb
File metadata and controls
109 lines (109 loc) · 5.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<% term ||= nil %>
<tr class="term" id="term_<%= term ? term.id : "blank" %>" style="<%= hidden unless term %>">
<td class="header">
<div class="show_term">
<span class="name"><%= term.name rescue nbsp %></span>
</div>
<div class="show_term" style="font-size: 0.8em;">
<% if term && (term.sis_source_id && can_do(@root_account, @current_user, :read_sis) || can_do(@root_account, @current_user, :manage_sis)) %>
<div style="font-size: 0.8em;">
<%= before_label :sis_id, "SIS ID" %> <span class="sis_source_id"><%= term.sis_source_id %></span>
</div>
<% end %>
<% if term.try(:grading_period_group).try(:active?) %>
<div style="font-size: 0.8em;">
<%= before_label :grading_period_set_title, "Grading Period Set" %>
<span class="grading_period_set_title">
<%= link_to grading_period_set_title(term.grading_period_group, term.root_account.name),
context_url(@context, :context_grading_standards_url) %>
</span>
</div>
<% end %>
<%= term && t(:course_count, "Course", :count => @course_counts_by_term[term.id] || 0) %><br/>
</div>
<%= form_for (term || EnrollmentTerm.new), :url => (term ? context_url(@context, :context_term_url, term.id) : context_url(@context, :context_terms_url)), :html => {:class => "enrollment_term_form", :method => (term ? :put : :post)} do |f| %>
<div class="control-group edit_term">
<label class="control-label" for="enrollment_term_name"><%= t :name, 'Term Name:' %></label>
<div class="controls">
<%= f.text_field :name, :class => "input-xlarge" %>
</div>
</div>
<% if can_do(@root_account, @current_user, :manage_sis) %>
<div class="control-group edit_term">
<label class="control-label" for="enrollment_term_sis_source_id"><%= t :sis_source_id, 'SIS ID:' %></label>
<div class="controls">
<%= f.text_field :sis_source_id, :class => "input-xlarge" %>
</div>
</div>
<% end %>
<% end %>
</td>
<% types = [StudentEnrollment, TeacherEnrollment, TaEnrollment, DesignerEnrollment] %>
<td class="permissions">
<table>
<tr class="general_dates">
<td>
<%= mt :term_runs_from, "**Term Runs** from" %>
</td>
<%= render :partial => 'timespan', :locals => { :object => term, :key => '', :start_tooltip => t('titles.term_starts', "Term starts"),
:end_tooltip => t('titles.term_ends', "Term ends"), :whenever => [true, true] } %>
</tr>
<% types.each do |type| %>
<% override = term.enrollment_dates_overrides.detect{|edo|
edo.context_type == @context.class.to_s &&
edo.context_id == @context.id &&
edo.enrollment_type == type.to_s
} if term %>
<% override ||= EnrollmentDatesOverride.new %>
<% type_string = type.to_s.underscore %>
<% start_whenever = true %>
<tr class="<%= "#{type_string}_dates"%>">
<td>
<% case type_string
when 'student_enrollment'
start_tooltip = t 'tooltips.term_starts_students', "For students the term starts"
end_tooltip = t 'tooltips.term_ends_students', "For students the term ends"
access_label = mt 'labels.students_can_access_from', "**Students** can access from"
start_whenever = false
when 'teacher_enrollment'
start_tooltip = t 'tooltips.term_starts_teachers', "For teachers the term starts"
end_tooltip = t 'tooltips.term_ends_teachers', "For teachers the term ends"
access_label = mt 'labels.teachers_can_access_from', "**Teachers** can access from"
when 'ta_enrollment'
start_tooltip = t 'tooltips.term_starts_tas', "For TAs the term starts"
end_tooltip = t 'tooltips.term_ends_tas', "For TAs the term ends"
access_label = mt 'labels.tas_can_access_from', "**TAs** can access from"
when 'designer_enrollment'
start_tooltip = t 'tooltips.term_starts_designers', "For designers the term starts"
end_tooltip = t 'tooltips.term_ends_designers', "For designers the term ends"
access_label = mt 'labels.designers_can_access_from', "**Designers** can access from"
end
%>
<%= access_label %>
</td>
<%= render :partial => 'timespan', :locals => { :object => override, :key => "[overrides][#{type_string}]",
:start_tooltip => start_tooltip, :end_tooltip => end_tooltip,
:date_class_prefix => "#{type_string}_", :whenever => [start_whenever, false] } %>
</tr>
<% end %>
<tr class="edit-buttons">
<td></td>
<td></td>
<td></td>
<td class="edit_term edit_term_buttons">
<button class="btn button-secondary cancel_button" type="button"><%= t '#buttons.cancel', "Cancel" %></button>
<button class="btn btn-primary submit_button" type="button"><%= term ? t('buttons.update', "Update Term") : t('buttons.add', "Add Term") %></button>
</td>
</tr>
</table>
</td>
<td class="links">
<a href="#" class="edit_term_link no-hover" title="<%= t 'Edit Term %{name}', name: term.try(:name) %>"><i class="icon-edit standalone-icon" aria-hidden="true"></i></a>
<% if term && @course_counts_by_term[term.id].to_i > 0 %>
<a href="#" class="cant_delete_term_link no-hover" title="<%= t 'Delete Term %{name}', name: term.try(:name) %>"><i class="icon-end standalone-icon" aria-hidden="true"></i></a>
<% elsif term != @context.default_enrollment_term %>
<a href="#" class="delete_term_link no-hover" title="<%= t 'Delete Term %{name}', name: term.try(:name) %>"><i class="icon-trash standalone-icon" aria-hidden="true"></i></a>
<% end %>
</td>
</tr>