forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_rubric.html.erb
More file actions
205 lines (203 loc) · 11.8 KB
/
Copy path_rubric.html.erb
File metadata and controls
205 lines (203 loc) · 11.8 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
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
<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>
<%
rubric_association ||= nil; editable ||= false; association_object = nil; edit_view ||= false
rubric ||= nil; assessing ||= false; assessment ||= nil; has_assessments ||= false
for_context ||= false
context = @context
context = context.context if context.is_a?(Group)
show_grading = !@assignment || @assignment.submission_types != 'online_quiz'
rubric_association = assessment.rubric_association if assessment
%>
<% cache(['rubric_render3',
(rubric.try(:cache_key) || 'no_rubric'),
(rubric.try(:cache_key) || context.asset_string),
(rubric_association.try(:cache_key) || 'no_association'),
(assessment.try(:cache_key) || 'no_assessment'),
editable,
edit_view,
assessing,
show_grading].join('/')) do %>
<div
class="rubric_container rubric <%= "assessing" if assessing %> <%= "for_grading" if rubric_association.try(:use_for_grading) %>"
id="<%= rubric ? "rubric_#{rubric.id}" : "default_rubric" %>"
style="<%= hidden unless rubric %>"
tabindex="0"
>
<div class="screenreader-only"><h2><%= t 'rubric', "Rubric" %></h2></div>
<div class="rubric_title">
<div style="float: right; <%= hidden unless editable && edit_view %>" class="links displaying">
<% hash = rubric_association ? {:rubric_association_id => rubric_association.id} : {} %>
<a
href="<%= context_url(context, :context_rubric_url, rubric ? rubric.id : "{{ id }}", hash) %>"
class="<%= 'copy_edit' if rubric && !can_do(rubric, @current_user, :update) %> edit_rubric_link no-print no-hover"
style="<%= hidden unless !rubric || can_do(rubric_association, @current_user, :update) %>"
title="<%= t 'links.edit', "Edit Rubric" %>"
aria-label="<%= t 'links.edit', "Edit Rubric" %>"
role="button"
><i class="icon-edit standalone-icon"></i></a>
<a
href="<%= search_rubrics_url(:q => "") %>"
class="find_rubric_link no-print no-hover"
style="<%= hidden unless !rubric || can_do(rubric_association, @current_user, :update) %>"
title="<%= t 'links.find_another_rubric', "Find Another Rubric" %>"
aria-label="<%= t 'links.find_another_rubric', "Find Another Rubric" %>"
role="button"
><i class="icon-search standalone-icon"></i></a>
<% if for_context %>
<a
href="<%= context_url(context, :context_rubric_url, rubric ? rubric.id : "{{ id }}") %>"
class="delete_rubric_link no-print no-hover"
style="<%= hidden unless !rubric || can_do(rubric_association, @current_user, :delete) %>"
title="<%= t 'links.delete', "Delete Rubric" %>"
aria-label="<%= t 'links.delete', "Delete Rubric" %>"
role="button"
><i class="icon-trash standalone-icon"></i></a>
<% else %>
<a
href="<%= context_url(context, :context_rubric_association_url, rubric_association ? rubric_association.id : "{{ rubric_association_id }}") %>"
class="delete_rubric_link no-print no-hover"
style="<%= hidden unless !rubric || can_do(rubric_association, @current_user, :delete) %>"
title="<%= t 'links.delete', "Delete Rubric" %>"
aria-label="<%= t 'links.delete', "Delete Rubric" %>"
role="button"
><i class="icon-trash standalone-icon"></i></a>
<% end %>
<div style="display: none;">
<div class="use_for_grading"><%= (rubric_association && rubric_association.use_for_grading) ? "true" : nbsp %></div>
<div class="free_form_criterion_comments"><%= (rubric && rubric.free_form_criterion_comments) ? "true" : nbsp %></div>
<div class="hide_score_total"><%= (rubric && rubric.hide_score_total) ? "true" : nbsp %></div>
<div class="rubric_association_id"><%= rubric_association ? rubric_association.id : nbsp %></div>
<div class="user_id"><%= assessment ? assessment.user_id : nbsp %></div>
<div class="assessment_type"><%= assessment ? assessment.assessment_type : "" %></div>
<a href="<%= context_url(context, :context_rubric_association_rubric_assessment_url, rubric_association ? rubric_association.id : "{{ rubric_association_id }}", (assessment ? assessment.id : "{{ assessment_id }}")) %>" rel="nofollow" class="edit_assessment_link"> </a>
<a href="<%= context_url(context, :context_rubric_url, "{{ rubric_id }}") %>" class="edit_rubric_url"> </a>
<% if for_context %>
<a href="<%= context_url(context, :context_rubric_url, rubric ? rubric.id : "{{ id }}") %>" class="delete_rubric_url"> </a>
<% else %>
<a href="<%= context_url(context, :context_rubric_association_url, "{{ association_id }}") %>" class="delete_rubric_url"> </a>
<% end %>
</div>
</div>
<div style="float: right; font-size: 0.8em; display: none;" class="links displaying locked">
<span style="<%= hidden if editable %>"><%= t 'messages.locked', "Can't change a rubric once you've started using it." %></span>
<% if for_context %>
<a href="<%= context_url(context, :context_rubric_url, rubric ? rubric.id : "{{ id }}") %>" class="delete_rubric_url" style="display: none;"> </a>
<% else %>
<a href="<%= context_url(context, :context_rubric_association_url, "{{ association_id }}") %>" class="delete_rubric_url" style="display: none;"> </a>
<% end %>
</div>
<div class="editing" style="float: right;">
<a href="<%= search_rubrics_url(:q => "") %>" class="find_rubric_link icon-search" style="<%= hidden unless !rubric || can_do(rubric_association, @current_user, :update) %>" title="<%= t 'titles.find_existing_rubric', "Find Existing Rubric" %>"><%= t 'links.find_a_rubric', "Find a Rubric" %></a>
</div>
<div class="editing" style="text-align: left">
<label for="rubric-title"><%= t('title', "Title:") %></label>
<input id="rubric-title" type="text" class="no-margin-bottom" name="title" value="<%= rubric.title rescue t('defaults.rubric_title', "Some Rubric") %>" style="width: 200px;" maxlength="255" aria-label="<%= t('title', "Title:") %>"/>
<a href="<%= search_rubrics_url(:q => "") %>" style="display: none;"><%= image_tag "find.png", :alt => '' %> <%= t 'links.find_rubric', "Find Rubric" %></a>
<% if rubric_association && !rubric_association.rubric_assessments.empty? %>
<div class="editing" style="font-size: 0.8em;"><%= t 'messages.rubric_in_use',
{ :one => "Keep in mind that 1 student has already been assessed using this rubric. Changing it will affect their evaluation.",
:other => "Keep in mind that %{count} students have already been assessed using this rubric. Changing it will affect their evaluations." },
:count => rubric_association.rubric_assessments.count %></div>
<% end %>
</div>
<div class="displaying">
<span class="title" tabindex="-1"><%= rubric.try(:title) || t(:rubric_title, "Title") %></span>
</div>
<div class="has-assessments-warning" style="<%= hidden unless edit_view && has_assessments %>">
<%= t 'messages.rubric_in_use2', "You've already rated students with this rubric. Any major changes could affect their assessment results." %>
</div>
</div>
<table class="rubric_table">
<caption>
<div class="screenreader-only">
<span class="title"><%= rubric.try(:title) || t(:rubric_title, "Title") %></span>
</div>
</caption>
<thead>
<tr>
<th scope="col"><%= t 'headers.criteria', "Criteria" %></th>
<th scope="col"><%= t 'headers.ratings', "Ratings" %></th>
<th scope="col"><%= t 'headers.points', "Pts" %></th>
<th scope="col" class="editing"> </th>
</tr>
</thead>
<tbody>
<% if rubric && rubric.criteria %>
<% rubric.criteria_object.each do |criterion| %>
<% rating = assessment.ratings.find{|r| r[:criterion_id] == criterion.id} rescue nil %>
<%= render :partial => "shared/rubric_criterion", :object => criterion, :locals => {:assessing => assessing, :assessment_rating => rating, :rubric => rubric, :rubric_association => rubric_association, :edit_view => edit_view} %>
<% end %>
<% end %>
<%= render :partial => "shared/rubric_criterion", :object => nil %>
<tr class="summary" style="<%= hidden if rubric_association && rubric_association.hide_score_total %>">
<td colspan="4">
<div style="float: right;" class="total_points_holder">
<span style="padding-right: 10px;"><%= before_label :total_points, "Total Points" %>
<% ot(:out_of, "%{points} *out of %{total}*", :points => capture { %>
<span class="rubric_total">
<%=
assessment ? n(assessment.score) : n((rubric.points_possible rescue 5))
%>
</span>
<%
},
wrapper: '<span class="assessing">\1</span>',
total: n((rubric.points_possible rescue 5)))
%>
</span>
</div>
<div style="float: left;" class="editing">
<a href="#" aria-label='<%= t("Add Criterion") %>' class="icon-plus add_criterion_link"><%= t("Criterion") %></a>
<a href="#" class="icon-search find_outcome_link outcome"><%= t 'links.find_outcome', "Find Outcome" %></a>
</div>
<div class="clear"></div>
</td>
</tr>
</tbody>
</table>
</div>
<table style="display: none;">
<tr id="edit_rubric">
<td colspan="4">
<form id="edit_rubric_form" class="edit-rubric-form no-margin-bottom">
<div class="rubric_custom_ratings" style="<%= hidden unless @assignment %>">
<input type="checkbox" id="rubric_custom_rating" class="rubric_custom_rating" <%= 'checked' if rubric && rubric.free_form_criterion_comments %>/>
<label for="rubric_custom_rating"><%= t 'labels.custom_rating', "I'll write free-form comments when assessing students" %></label>
</div>
<% if show_grading %>
<div class="rubric_grading" style="<%= hidden unless @assignment %>">
<input type="checkbox" id="grading_rubric" class="grading_rubric_checkbox" <%= 'checked' if rubric_association && rubric_association.use_for_grading %>/>
<label for="grading_rubric"><%= t 'labels.grading_rubric', "Use this rubric for assignment grading" %></label>
</div>
<% end %>
<div class="totalling_rubric" style="<%= hidden unless @assignment %>">
<input type="checkbox" id="totalling_rubric" class="totalling_rubric_checkbox" <%= 'checked' if rubric_association && rubric_association.hide_score_total %>/>
<label for="totalling_rubric"><%= t 'labels.totallying_rubric', "Hide score total for assessment results" %></label>
</div>
<div class="ic-Action-header ic-Action-header--half-margin">
<div class="ic-Action-header__Primary">
<button type="button" class="Button cancel_button"><%= t '#buttons.cancel', "Cancel" %></button>
<button type="submit" class="Button Button--primary save_button"><%= t 'buttons.create', "Create Rubric" %></button>
</div>
</div>
</form>
</td>
</tr>
</table>
<% end %>