grading_standard.mustache 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <%
  2. # Copyright (C) 2011 - present Instructure, Inc.
  3. #
  4. # This file is part of Canvas.
  5. #
  6. # Canvas is free software: you can redistribute it and/or modify it under
  7. # the terms of the GNU Affero General Public License as published by the Free
  8. # Software Foundation, version 3 of the License.
  9. #
  10. # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
  11. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License along
  16. # with this program. If not, see <http://www.gnu.org/licenses/>.
  17. %>
  18. <% grading_standard ||= GradingStandard.default_instance %>
  19. <div class="grading_standard" id="grading_standard_<%= grading_standard && grading_standard.id ? grading_standard.id : 'blank' %>">
  20. <div class="display_grading_standard">
  21. <div class="standard_title text-center">
  22. <% if !read_only %>
  23. <div style="float: right;" class="displaying links">
  24. <a href="#"
  25. class="find_grading_standard_link no-hover"
  26. aria-label="{{#t}}Find an Existing Grading Scheme{{/t}}"
  27. title="{{#t}}Find an Existing Grading Scheme{{/t}}">
  28. <%= image_tag "find.png", :alt => t('find', "Find") %> {{#t}}Select Another Scheme{{/t}}
  29. </a>
  30. <a href="#"
  31. title="{{#t}}Edit Grading Scheme{{/t}}"
  32. aria-label="{{#t}}Edit Grading Scheme{{/t}}"
  33. class="edit_grading_standard_link no-hover <%= 'read_only' if grading_standard && grading_standard.assessed_assignment? %>">
  34. <i class="icon-edit standalone-icon"></i>
  35. </a>
  36. <a href="#"
  37. title="{{#t}}Remove Grading Scheme{{/t}}"
  38. aria-label="{{#t}}Remove Grading Scheme{{/t}}"
  39. class="remove_grading_standard_link no-hover <%= 'read_only' unless grading_standard %>">
  40. <i class="icon-end standalone-icon"></i>
  41. </a>
  42. </div>
  43. <% end %>
  44. <strong class="displaying title"><%= grading_standard.title %></strong>
  45. <div class="editing_box">
  46. <label for="grading_standard_title"><%= before_label('scheme_name', 'Scheme Name') %></label>
  47. <input type="text"
  48. id="grading_standard_title"
  49. name="grading_standard[title]"
  50. class="scheme_name"
  51. value="<%= grading_standard.title %>"
  52. style="width: 200px;"/>
  53. </div>
  54. </div>
  55. <table style="width: 100%; margin-bottom: 20px;" class="grading_standard_data">
  56. <caption class="screenreader-only">
  57. {{#t}}Current grading scheme for this assignment{{/t}}
  58. </caption>
  59. <thead>
  60. <tr>
  61. <th id="name_header" style="text-align: left; padding-right: 10px; width: 25%;"><%= before_label('name', 'Name') %></th>
  62. <th colspan="3" style="width: 75%;">
  63. <div style="float: left; margin-left: 10px;"><%= before_label('range', 'Range') %></div>
  64. <div class="clear"></div>
  65. </th>
  66. </tr>
  67. </thead>
  68. <tr class="insert_grading_standard" style="display: none; font-size: 0.7em; line-height: 0.6em;">
  69. <td colspan="4">
  70. <a href="#" class="insert_grading_standard_link">{{#t}}insert here{{/t}}</a>
  71. </td>
  72. </tr>
  73. <% grading_standard.data.each_with_index do |row, idx| %>
  74. <tr class="grading_standard_row">
  75. <td style="width: 25%;">
  76. <div class="editing_box">
  77. <input type="text" class="standard_name" name="grading_standard[standard_data][scheme_<%= idx %>][name]" value="<%= row[0] %>" style="width: 100px;" aria-labelledby="name_header"/>
  78. </div>
  79. <div class="displaying name">
  80. <%= row[0] %>
  81. </div>
  82. </td>
  83. <td style="padding: 2px 5px; width: 25%;" class="max_score_cell" aria-label="{{#t}}Upper limit of range{{/t}}">
  84. <div class="editing_box" aria-hidden="true">
  85. <span class="edit_max_score">
  86. <% if idx == 0 %>
  87. <%= I18n.n(100) %>
  88. <% else %>
  89. <%= I18n.n((grading_standard.data[idx - 1][1] * 100).round(2)) %>
  90. <% end %>
  91. </span>%
  92. </div>
  93. <div class="displaying">
  94. <span class="max_score">
  95. <% if idx == 0 %>
  96. <%= I18n.n(100) %>
  97. <% else %>
  98. &lt; <%= I18n.n((grading_standard.data[idx - 1][1] * 100).round(2)) %>
  99. <% end %>
  100. </span>%
  101. </div>
  102. </td>
  103. <td style="padding: 2px 5px; width: 25%;">
  104. <div class="editing_box">
  105. <span style="padding-right: 5px;" aria-hidden="true">{{#t}}%{lower_number} to %{higher_number}', :lower_number => '', :higher_number => '{{/t}}</span>
  106. <input
  107. type="text"
  108. class="standard_value"
  109. title="{{#t}}Lower limit of range{{/t}}"
  110. aria-label="{{#t}}Lower limit of range{{/t}}"
  111. name="grading_standard[standard_data][scheme_<%= idx %>][value]"
  112. value="<%= I18n.n(row[1] * 100) %>"
  113. style="width: 37px;"/>%
  114. </div>
  115. <div class="displaying">
  116. <span style="padding-right: 5px;">{{#t}}%{lower_number} to %{higher_number}', :lower_number => '', :higher_number => '{{/t}}</span>
  117. <span class="min_score"><%= I18n.n((row[1] * 100).round(2)) %></span>%
  118. </div>
  119. </td>
  120. <td class="editing_box" style="padding: 2px 5px 2px 15px; width: 25%;">
  121. <a href="#" class="delete_row_link no-hover" tabindex="0" aria-label="{{#t}}Remove row')%>" title="<%= t('remove_row', 'Remove row{{/t}}"><i class="icon-end standalone-icon"></i></a>
  122. </td>
  123. </tr>
  124. <tr class="insert_grading_standard" style="display: none; font-size: 0.7em; line-height: 0.6em;">
  125. <td colspan="4">
  126. <a href="#" class="insert_grading_standard_link">{{#t}}insert here{{/t}}</a>
  127. </td>
  128. </tr>
  129. <% end %>
  130. <tr class="insert_grading_standard" style="display: none; font-size: 0.7em; line-height: 0.6em;">
  131. <td colspan="4">
  132. <a href="#" class="insert_grading_standard_link">{{#t}}insert here{{/t}}</a>
  133. </td>
  134. </tr>
  135. <tr class="grading_standard_row blank" style="display: none;">
  136. <td>
  137. <div class="editing_box">
  138. <input type="text" class="standard_name" name="grading_standard[standard_data][scheme_blank][name]" value="" style="width: 100px;"/>
  139. </div>
  140. <div class="displaying">
  141. &nbsp;
  142. </div>
  143. </td>
  144. <td style="padding: 2px 5px;">
  145. <div class="editing_box">
  146. <span style="padding-right: 5px;">{{#t}}%{lower_number} to %{higher_number}', :lower_number => '', :higher_number => '{{/t}}</span>
  147. <span class="edit_max_score">&nbsp;</span>%
  148. </div>
  149. <div class="displaying">
  150. <span style="padding-right: 5px;">{{#t}}%{lower_number} to %{higher_number}', :lower_number => '', :higher_number => '{{/t}}</span>
  151. <span class="max_score">&nbsp;</span>%
  152. </div>
  153. </td>
  154. <td style="padding: 2px 5px;">
  155. <div class="editing_box">
  156. <input type="text" class="standard_value" name="grading_standard[standard_data][scheme_blank][value]" value="" style="width: 30px;"/>%
  157. </div>
  158. <div class="displaying">
  159. <span class="min_score">&nbsp;</span>%
  160. </div>
  161. </td>
  162. <td class="editing_box" style="padding: 2px 5px 2px 15px;">
  163. <a href="#" class="delete_row_link no-hover"><i class="icon-end standalone-icon"></i></a>
  164. </td>
  165. </tr>
  166. </table>
  167. <div class="displaying" style="text-align: right;">
  168. <% if !read_only %>
  169. <a href="<%= context_url(@context, :context_grading_standards_url) %>">{{#t}}manage grading schemes{{/t}}</a>
  170. <% end %>
  171. <button type="button" class="done_button btn">{{#t}}Done{{/t}}</button>
  172. </div>
  173. <div class="editing_box form-actions">
  174. <button type="button" class="btn cancel_button">{{#t}}Cancel{{/t}}</button>
  175. <button type="button" class="btn btn-primary save_button">{{#t}}Save{{/t}}</button>
  176. </div>
  177. </div>
  178. <div style="display: none;" class="find_grading_standard">
  179. <a href="<%= context_url(@context, :context_grading_standards_url) %>" rel="nofollow" class="grading_standards_url" style="display: none;">&nbsp;</a>
  180. <div class="loading_message" style="margin: 10px; text-align: center;">
  181. {{#t}}Loading Grading Standards...{{/t}}
  182. </div>
  183. <% css_bundle("side_tabs_table") %>
  184. <table class="side_tabs_table grading_standards_holder" style="display: none;">
  185. <tr>
  186. <td class="left">
  187. <ul class="grading_standards_select unstyled_list side_tabs">
  188. <li class="grading_standard_select blank" style="display: none;">
  189. <a href="#">
  190. <span class="title">{{#t}}Some standard{{/t}}</span>
  191. <span class="id" style="display: none;">&nbsp;</span>
  192. </a>
  193. <div class="display_name" style="font-size: 0.8em;">{{#t}}Full name, smaller text{{/t}}</div>
  194. </li>
  195. </ul>
  196. </td>
  197. <td class="right">
  198. <div class="side_tabs_content grading_standards">
  199. <div style="margin-bottom: 10px; display: none;" class="grading_standard_brief blank">
  200. <span class="id" style="display: none;">&nbsp;</span>
  201. <div>
  202. <div style="float: left;">
  203. <a href="#" class="select_grading_standard_link"><b class="title">&nbsp;</b></a>
  204. <span class="user_name" style="padding-left: 10px; font-size: 0.8em; color: #888;">
  205. &nbsp;
  206. </span>
  207. </div>
  208. <div class="clear"></div>
  209. </div>
  210. <div class="clear"></div>
  211. <div style="margin-left: 30px;" class="details">
  212. <table style="font-size: 0.8em;">
  213. <tr class="details_row blank" style="display: none;">
  214. <td class="name" style="padding-right: 20px;">&nbsp;</td>
  215. <td style="padding: 2px 5px;"><span class="value">&nbsp;</span>%</td>
  216. <td style="padding: 2px 5px;">{{#t}}%{lower_number} to %{higher_number}', :lower_number => '', :higher_number => '{{/t}}</td>
  217. <td style="padding: 2px 5px;"><span class="next_value">&nbsp;</span>%</td>
  218. </tr>
  219. </table>
  220. </div>
  221. <button type="button" class="btn select_grading_standard_link">{{#t}}Use This Grading Standard{{/t}}</button>
  222. </div>
  223. </div>
  224. </td>
  225. </tr>
  226. </table>
  227. <div style="margin-top: 5px; text-align: right"><a href="#" class="cancel_find_grading_standard_link">{{#t}}Cancel{{/t}}</a></div>
  228. </div>
  229. <a href="<%= context_url(((grading_standard.context || @context) rescue @context), :context_grading_standard_url, grading_standard ? grading_standard.id : "{{ id }}") rescue "#" %>" style="display: none;" class="update_grading_standard_url">&nbsp;</a>
  230. <textarea id="default_grading_standard_data" style="display: none;"><%= GradingStandard.default_grading_standard.to_json %></textarea>
  231. </div>