forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrade_summary.html.erb
357 lines (350 loc) · 21.1 KB
/
grade_summary.html.erb
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<%
js_bundle :grade_summary, :rubric_assessment
jammit_css :grade_summary
content_for :page_title, join_title(t(:page_title, "Grades for %{student}", :student => @presenter.student_name), @context.name)
%>
<h1 class="screenreader-only"><%= t(:page_title, "Grades for %{student}", :student => @presenter.student_name) %></h1>
<% content_for :right_side do %>
<div class="rs-margin-all">
<% if @domain_root_account.try_rescue(:enable_user_notes) and can_do(@user, @current_user, :read_user_notes) %>
<a href="<%= user_user_notes_path(@user) %>" class="btn button-sidebar-wide"><%= t(:faculty_journal, "Faculty Journal for %{user}", :user => context_user_name(@context, @user)) %></a>
<% end %>
<% if @context.hide_final_grades? %>
<div class="student_assignment final_grade" style="font-size: 1.2em;">
<%= t('labels.final_grade_hidden', "Calculation of totals has been disabled") %>
</div>
<% else %>
<div class="student_assignment final_grade" style="font-size: 1.2em;">
<%= before_label(:total, "Total") %> <span class="grade"></span>
<% if @context.grading_standard_enabled? %>
<span class="final_letter_grade">
(<span class="grade" id="final_letter_grade_text">-</span>)
</span>
<% end %>
</div>
<% end %>
<% if @presenter.editable? %>
<div class="show_guess_grades" style="display: none; margin-bottom: 10px; font-size: 0.8em;">
<button type="button" class="btn button-sidebar-wide show_guess_grades_link"><%= image_tag "grading_icon.png", :alt => "" %> <%= t('buttons.show_what_if', "Show Saved \"What-If\" Scores") %></button>
</div>
<div class="revert_all_scores" style="font-size: 0.8em; padding-left: 10px; display: none;">
<%= t(:not_official, "*NOTE*: This is NOT your official score.") %><br/>
<a href="#" class="btn revert_all_scores_link"><%= image_tag "back.png", :alt => "" %> <%= t('links.revert_score', "Revert to Actual Score") %></a>
</div>
<% end %>
<div class="show_all_details" style="font-size: 0.8em; margin-top: 10px;">
<a href="#" class="btn" id="show_all_details_link"><%= t('links.show_details', "Show All Details") %></a>
</div>
<div style="margin-top: 10px;">
<%= render :partial => "courses/sidebar_weighting", :object => @presenter.groups %>
<% unless @presenter.no_calculations? %>
<div id="only_consider_graded_assignments_wrapper">
<label class="checkbox" for="only_consider_graded_assignments"><%= t('labels.only_graded', "Calculate based only on graded assignments") %>
<input type="checkbox" id="only_consider_graded_assignments" checked="true"/>
</label>
</div>
<% end %>
</div>
<% if @presenter.editable? %>
<div style="margin-top: 10px;">
<%= t(:change_score_instructions, "Click any score and enter a new value to see how the change will affect your total.") %>
</div>
<% end %>
</div>
<% end %>
<a class="btn btn-small print-grades icon-printer" href="javascript:window.print()">
<%= t :print_grades, "Print grades" %>
</a>
<h2>
<% ot('headers.grades', "Grades For %{student}", :student => capture { %>
<% unless @presenter.multiple_observed_students? %>
<%= @presenter.student_name %>
<% else %>
<select id="observer_user_url">
<% @presenter.linkable_observed_students.each do |student| %>
<% url = context_url(@context, :context_student_grades_url, student.id) %>
<option value="<%= url %>" <%= 'selected' if student == @presenter.student %>><%= student.name %></option>
<% end %>
</select>
<% end %>
<% }) %>
</h2>
<% if @presenter.has_courses_with_grades? %>
<div style="margin-left: 10px;">
<%= t(:for_course, "For the course,") %>
<select id="course_url">
<% @presenter.selectable_courses.each do |course| %>
<%
url = if course.grants_rights?(@current_user, nil, :manage_grades, :view_all_grades).values.any?
context_url(course, :context_student_grades_url, @presenter.student_id)
else
context_url(course, :context_grades_url)
end
%>
<option value="<%= url %>" <%= 'selected' if course == @context %>><%= course.name %></option>
<% end %>
</select>
</div>
<% js_bundle 'legacy/gradebooks_grade_summary' %>
<% end %>
</h2>
<% if @context.feature_enabled?(:student_outcome_gradebook) %>
<ul id="navpills">
<li><a href="#assignments"><%= t :assignments, "Assignments" %></a></li>
<li><a href="#outcomes"><%= t :learning_outcomes, "Learning Mastery" %></a></li>
</ul>
<div id="outcomes"></div>
<% end %>
<div id="assignments">
<table style="width: 100%;" id="grades_summary" class="<%= 'editable' if @presenter.editable? %>">
<thead>
<tr>
<th scope="col"><%= t('headers.name', "Name") %></th>
<th scope="col"><%= t('headers.due', "Due") %></th>
<th scope="col" class="assignment_score"><%= t('headers.score', "Score") %></th>
<th scope="col" class="possible"><%= t('headers.out_of', "Out of") %></th>
<th scope="col"><span class="screenreader-only"><%= t('headers.details', "Details") %></span></th>
</tr>
</thead>
<% @presenter.assignment_presenters.each do |assignment_presenter| %>
<%
submission = assignment_presenter.submission
assignment = assignment_presenter.assignment
can_view_distribution = can_do(@context, @current_user, :read_as_admin) || !assignment_presenter.hide_distribution_graphs?
%>
<tr class="student_assignment <%= 'assignment_graded' if assignment_presenter.graded? %> <%= assignment_presenter.special_class %>" data-muted="<%= assignment.muted? %>" id="<%= "submission_" + assignment.id.to_s %>">
<th class="title" scope="row">
<% if assignment_presenter.is_unread? %>
<div class="unread-grade"> </div>
<% end %>
<% if assignment_presenter.is_assignment? %>
<a href="<%= context_url(@context, :context_assignment_submission_url, assignment, @presenter.student_id) %>"><%= assignment.title %></a>
<% else %>
<%= assignment.title %>
<% end %>
<% if assignment_presenter.group %>
<div class="context"><%= assignment_presenter.group.name %></div>
<% end %>
</td>
<td class="due">
<% if assignment_presenter.has_no_group_weight? %>
<%= datetime_string(assignment.due_at, :due_date) rescue "" %>
<% end %>
</td>
<td class="assignment_score" title="<%= t(:click_to_change, "Click to test a different score") unless assignment_presenter.unchangeable? %>">
<div style="position: relative; height: 100%;" class="score_holder">
<span class="tooltip">
<span class="tooltip_wrap right">
<% if @presenter.editable? || assignment.special_class %>
<span class="tooltip_text score_teaser">
<% if assignment.muted? %>
<%= t(:student_mute_notification, "Instructor is working on grades") %>
<% elsif assignment.special_class %>
<%= t(:total, "Total") %>
<% else %>
<%= t(:click_to_change, "Click to test a different score") %>
<% end %>
</span>
<% end %>
</span>
<span class="grade" tabindex="0">
<% if assignment.muted? %>
<%= image_tag "sound_mute.png", :alt => t("#gradebooks.grade.muted", "Muted"), :class => "muted_icon" %>
<% else %>
<span class="screenreader-only" role="link">
<%= t(:click_to_change, "Click to test a different score") unless assignment_presenter.unchangeable? %>
</span>
<%= render :partial => 'submission_score', :object => submission, :locals => {:student_score => !can_do(@context, @current_user, :manage_grades)} %>
<% end %>
</span>
<% if assignment_presenter.is_letter_graded? || assignment_presenter.is_gpa_scaled?%>
<span class="score_value" style="font-size: 0.8em; color: #aaa;">
<%= assignment_presenter.display_score %>
</span>
<% end %>
</span>
<div style="display: none;">
<span class="original_score">
<%= assignment_presenter.display_score %>
</span>
<span class="score">
<%= assignment_presenter.display_score %>
</span>
<span class="assignment_group_id"><%= assignment.assignment_group_id rescue "" %></span>
<span class="assignment_id"><%= assignment.id.to_s %></span>
<span class="group_weight"><%= assignment.group_weight rescue "" %></span>
<span class="student_entered_score"><%= submission.student_entered_score rescue "" %></span>
<span class="rules"><%= assignment.rules rescue "" %></span>
</div>
</div>
</td>
<td class="possible points_possible" <%= "colspan='2'".html_safe if assignment.special_class %>><%= assignment.points_possible %></td>
<% if !assignment.special_class %>
<td class="details">
<a href="#" class="toggle_comments_link tooltip" aria-label="<%= t(:comment_count_screenreader, 'Read comments') %>" <% if assignment_presenter.has_comments? %>aria-expanded="false" aria-controls="comments_thread_<%= assignment.id %>"<% else %>aria-hidden='true' role='presentation' tabindex='-1'<% end %> style="<%= 'visibility: hidden;' unless assignment_presenter.has_comments? %>">
<span class="tooltip_wrap right">
<span class="tooltip_text"><%= t(:comment_count, "comment", :count => (submission.visible_submission_comments.size rescue 0)) %></span>
</span>
<i class="icon-discussion standalone-icon"></i>
</a>
<a href="#" class="toggle_score_details_link tooltip" aria-label="<%= t(:see_scoring_details_screenreader, 'See scoring details') %>" <% if assignment_presenter.has_scoring_details? && can_view_distribution %>aria-expanded="false" aria-controls="grade_info_<%= assignment.id %>"<% else %>aria-hidden='true' role='presentation' tabindex='-1'<% end %> title="<%= t 'titles.view_scoring_details', 'View Scoring Details' %>" style="<%= 'visibility: hidden;' unless (assignment_presenter.has_scoring_details? && can_view_distribution) %>">
<span class="tooltip_wrap right">
<span class="tooltip_text"><%= t(:see_scoring_details, "See scoring details") %></span>
</span>
<i class="icon-check-plus standalone-icon"></i>
</a>
<a href="#" class="toggle_rubric_assessments_link tooltip" aria-label="<%= t(:see_rubric_results_screenreader, 'See rubric results') %>" aria-expanded='false' aria-controls="rubric_<%= assignment.id %>" tabindex='0' title="<%= t 'titles.view_rubric_evaluation', 'View Rubric Evaluation' %>" style="<%= 'visibility: hidden;' if !assignment_presenter.has_rubric_assessments? %>">
<span class="tooltip_wrap right">
<span class="tooltip_text"><%= t(:see_rubric_results, "See rubric results") %></span>
</span>
<%= image_tag "rubric.png", :alt => t('icons.rubric_results', 'See rubric results') %>
</a>
<% if @presenter.turnitin_enabled? %>
<%
turntitin = nil
url = '#'
if can_do(submission, @current_user, :view_turnitin_report)
turnitin = assignment_presenter.turnitin
if assignment_presenter.is_text_entry?
url = context_url(@context, :context_assignment_submission_turnitin_report_url, assignment.id, @presenter.student_id, submission.asset_string)
elsif assignment_presenter.is_online_upload? && assignment_presenter.file
asset_string = assignment_presenter.file.asset_string
url = context_url(@context, :context_assignment_submission_turnitin_report_url, assignment.id, @presenter.student_id, asset_string)
end
end
%>
<a class="tooltip" title="<%= t('titles.turnitin_score', "Turnitin similarity score -- more information") %>" href="<%= url %>" style="<%= 'visibility: hidden;' if !turnitin %>" target="_blank">
<%= turnitin ? image_tag("turnitin_#{turnitin && turnitin[:state]}_score.png", :alt => t('icons.turnitin_results', 'See Turnitin results')) : image_tag("blank.png", :alt => '') %>
<span class="tooltip_wrap right">
<span class="tooltip_text"><%= t(:see_turnitin_results, "See Turnitin results") %></span>
</span>
</a>
<% end %>
</td>
<% end %>
</tr>
<%# always add row (even if empty) so javascript references work %>
<tr id="grade_info_<%= assignment.id %>" class="comments grade_details <%= 'assignment_graded' if assignment_presenter.graded? %>" style="display: none;">
<% if assignment_presenter.should_display_details? %>
<td colspan="5" style="padding-bottom: 20px;">
<% if assignment_presenter.has_grade_distribution? && can_view_distribution %>
<% high, low, mean = assignment_presenter.grade_distribution %>
<% title = "" %>
<% title += " " + before_label(:mean_score, "Mean") + " " + (mean.round(1) rescue 0).to_s %>
<% title += " " + before_label(:high_score, "High") + " " + high.to_s %>
<% title += " " + before_label(:low_score, "Low") + " " + low.to_s %>
<% if mean && high && low %>
<table id="score_details_<%= assignment.id %>" class="score_details_table">
<thead>
<tr>
<th colspan="3">
Score Details
</th>
<th>
<a href="#" data-aria="grade_info_<%= assignment.id %>" aria-label="<%= t(:close_score_screenreader, 'Close score details') %>" class="screenreader-toggle pull-right"><%= t(:close_score, "Close") %></a>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<%= before_label(:mean, "Mean") %>
<%= mean.round(1) %>
</td>
<td>
<%= before_label(:high, "High") %>
<%= high %>
</td>
<td>
<%= before_label(:low, "Low") %>
<%= low %>
</td>
<td>
<div style="cursor: pointer; float: right; height: 30px; margin-left: 20px; width: 160px; position: relative; margin-right: 30px;" title="<%= title %>">
<% graph = assignment_presenter.graph %>
<div style="position: absolute; top: 0; left: 0; width: 0px; height: 10px; margin: 5px 0px; border: 2px solid #aaa; overflow: hidden; border-right-width: 0;"> </div>
<div style="position: absolute; top: 0; left: 0px; width: <%= graph.low_width %>px; height: 0px; margin-top: 10px; border-bottom: 2px solid #aaa; overflow: hidden; border-top-width: 0;"> </div>
<div style="position: absolute; top: 0; left: <%= graph.high_left %>px; width: <%= graph.high_width %>px; height: 0px; margin-top: 10px; border-bottom: 2px solid #aaa; overflow: hidden;"> </div>
<div style="position: absolute; top: 0; left: <%= graph.low_width %>px; width: <%= graph.mean_low_width %>px; height: 20px; border: 2px solid #aaa; overflow: hidden; -moz-border-radius-topleft: 3px; -moz-border-radius-bottomleft: 3px; border-right-width: 0; background: #fff;"> </div>
<div style="position: absolute; top: 0; left: <%= graph.mean_left%>px; width: <%= graph.mean_high_width%>px; height: 20px; border: 2px solid #aaa; overflow: hidden; -moz-border-radius-topright: 3px; -moz-border-radius-bottomright: 3px; background: #fff;"> </div>
<div style="position: absolute; top: 0; left: <%= graph.max_left %>px; width: 0px; height: 10px; margin: 5px 0px; border: 2px solid #aaa; overflow: hidden; border-left-width: 0;"> </div>
<% if submission && submission.score %>
<div style="position: absolute; top: 5px; height: 10px; width: 10px; left: <%= graph.score_left %>px; border: 2px solid #248; background-color: #abd; overflow: hidden; -moz-border-radius: 3px;" title="<%= before_label(:your_score, "Your Score") %>
<%= t(:submission_score, "*%{score}* out of %{possible}", :wrapper => '\1', :score => submission.score, :possible => assignment.points_possible) %>">
</div>
<% end %>
</div>
</td>
</tr>
</tbody>
</table>
<% end %>
<% end %>
</tr>
<tr id="comments_thread_<%= assignment.id %>" class="comments comments_thread <%= 'assignment_graded' if assignment_presenter.graded? %>" style="display: none;">
<td colspan="5">
<% if assignment_presenter.has_comments? %>
<table class="score_details_table">
<thead>
<tr>
<th>Comments</th>
<th>
<a href="#" data-aria="comments_thread_<%= assignment.id %>" aria-label="<%= t(:close_comments_label, 'Close comments') %>" class="screenreader-toggle pull-right"><%= t(:close_comments, "Close") %></a>
</th>
</tr>
</thead>
<tbody>
<% assignment_presenter.comments.each do |comment| %>
<tr>
<td>
<% if comment.media_comment_id && comment.media_comment_type %>
<div class="comment_media">
<%= t(:media_comment, "This is a media comment,") %><br/>
<a href="#" class="play_comment_link <%= comment.media_comment_type %>_comment"><%= t('links.click_to_view', "click here to view") %></a>
<span class="media_comment_id" style="display: none;"><%= comment.media_comment_id %></span>
<div class="media_comment_content"></div>
</div>
<% else %>
<span style="white-space: pre-wrap;"><%= comment.comment %></span>
<% end %>
<div style="text-align: right; font-size: 0.8em; margin-right: 10px; clear: both;">
<% comment.attachments.each do |attachment| %>
<div>
<a href="<%= context_url(@context, :context_assignment_submission_url, submission.assignment_id, submission.user_id, :download => attachment.id, :comment_id => comment.id) %>"><%= image_tag "file.png", :style => "height: 12px;", :alt => "" %><%= t('links.download', "Download %{attachment}", :attachment => attachment.display_name) %></a>
</div>
<% end %>
</div>
</td>
<td>
<%= comment.author_name %>, <%= datetime_string(comment.created_at) %>
</td>
<% end %>
</tr>
</tbody>
</table>
<% end %>
<% end %>
</td>
</tr>
<tr id="rubric_<%= assignment.id %>" class="rubric_assessments <%= 'assignment_graded' if submission && submission.grade %>" style="display: none;">
<% if assignment_presenter.has_rubric_assessments? %>
<td colspan="5">
<% assignment_presenter.rubric_assessments.each do |assessment| %>
<div class="assessor" style="text-align: right; margin-bottom: 5px"><%= t(:assessment_by, "Assessment by %{name}", :name => assessment.assessor_name) %></div>
<div class="rubric-toggle"><a href="#" data-aria="rubric_<%= assignment.id %>" class="screenreader-toggle pull-left"><%= t(:close_rubric, 'Close Rubric') %></a></div>
<%= render :partial => "shared/rubric", :object => assessment.rubric, :locals => { :assessment => assessment } %>
<% end %>
</td>
<% end %>
</tr>
<% end %>
</table>
</div>
<% if @presenter.has_muted_assignments? %>
<small><%= image_tag "sound_mute.png", :alt => "" %><%= t(:student_mute_legend, "Your instructor is working on grades. While your instructor is working on grades, grade and comment information is unavailable.") %></small>
<% end %>
<div id="total_groups_weight" style="display: none;"><%= @presenter.total_weight %></div>
<%= render :partial => "shared/rubric_criterion_dialog" %>
<input type="text" style="width: 40px; display: none;" id="grade_entry" title="<%= t('titles.enter_score', "Enter a score to test") %>"/>
<a href="#" id="revert_score_template" class="revert_score_link" title="<%= t('titles.revert_score', "Revert to original score") %>"><%= image_tag "back.png", :alt => "" %></a>
<a href="<%= context_url(@context, :context_assignment_submission_url, "{{ assignment_id }}", @presenter.student_id) %>" class="update_submission_url" style="display: none;"> </a>