rubric_summary.mustache 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. <% rubric_summary ||= nil %>
  19. <% rubric = rubric_summary %>
  20. <% rubric_association ||= nil; editable ||= false; association_object = nil
  21. edit ||= false; rubic ||= nil; assessing ||= false; assessment ||= nil; brief ||= false %>
  22. <div class="rubric_container rubric rubric_summary <%= 'free_form' if rubric && rubric.free_form_criterion_comments %>" id="<%= rubric ? "rubric_summary_#{rubric.id}" : "default_rubric_summary" %>" style="<%= 'hidden' unless brief %>">
  23. <div class="screenreader-only"><h3><%= t 'rubric', "Rubric" %></h3></div>
  24. <div class="rubric_title" style="<%= hidden if brief %>">
  25. <span class="title"><%= rubric.try(:title) || t('defaults.title', "Title") %></span>
  26. <span class="id" style="display: none;"><%= rubric.id rescue nbsp %></span>
  27. </div>
  28. <table class="rubric_table">
  29. <caption>
  30. <div class="screenreader-only">
  31. <span class="title"><%= rubric.try(:title) || t('defaults.title', "Title") %></span>
  32. </div>
  33. </caption>
  34. <thead>
  35. <tr>
  36. <th><%= t 'headers.criteria', "Criteria" %></th>
  37. <th><%= t 'headers.assessment', "Assessment" %></th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. <% if rubric && rubric.criteria %>
  42. <% rubric.criteria_object.each do |criterion| %>
  43. <% rating = assessment.ratings.find{|r| r.criterion_id == criterion.id} rescue nil %>
  44. {{> views/shared/rubric_summary_criterion}}
  45. <% end %>
  46. <% else %>
  47. {{> views/shared/rubric_summary_criterion}}
  48. <% end %>
  49. <tr class="summary" style="<%= hidden if rubric_association && rubric_association.hide_score_total %>">
  50. <td colspan="2" style="padding-right: 10px; text-align: right;">
  51. <%= before_label :total_points, "Total Points" %>
  52. <%= t "*%{points}* out of **%{total}**",
  53. points: (assessing ? "0" : (I18n.n(rubric.points_possible) rescue 5)),
  54. total: (I18n.n(rubric.points_possible) rescue 5),
  55. wrapper: {
  56. '*' => "<span class='rubric_total' style='#{hidden if brief}'>\\1</span>",
  57. '**' => "<span class='points_possible'>\\1</span>"
  58. }
  59. %>
  60. </td>
  61. </tr>
  62. </tbody>
  63. </table>
  64. </div>
  65. <div class="button-container" style="<%= hidden if brief %>">
  66. <button class="toggle_full_rubric edit btn"><%= t 'buttons.edit_assessment', "Edit Assessment" %></button>
  67. </div>