sidebar_weighting.mustache 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. <% sidebar_weighting ||= nil %>
  19. <% groups = sidebar_weighting || @context.assignment_groups.active %>
  20. <div role="complementary" aria-label="{{#t}}Assignment Weights{{/t}}">
  21. <% if @context.group_weighting_scheme == "percent" %>
  22. <h2><%= before_label 'assignments_weighting', 'Assignments are weighted by group' %></h2>
  23. <table class="summary">
  24. <thead>
  25. <tr>
  26. <th scope='col'>{{#t}}Group{{/t}}</th>
  27. <th scope='col'>{{#t}}Weight{{/t}}</th>
  28. </tr>
  29. </thead>
  30. <tbody>
  31. <% if groups.empty? %>
  32. <tr>
  33. <th scope='row' colspan="2">{{#t}}No Groups Set Up{{/t}}</th>
  34. </tr>
  35. <% else %>
  36. <% tally = 0 %>
  37. <% groups.each do |group| %>
  38. <tr>
  39. <th scope='row'><%= group.name || t('default_name', "Group") %></th>
  40. <td><%= group.group_weight ? n(group.group_weight, percentage: true) : t('none') %></td>
  41. <% tally += group.group_weight || 0 %>
  42. </tr>
  43. <% end %>
  44. <tr style="font-weight: bold;">
  45. <th scope='row'>{{#t}}Total{{/t}}</th>
  46. <td><%= n(tally, percentage: true) %></td>
  47. </tr>
  48. <% end %>
  49. </tbody>
  50. </table>
  51. <% else %>
  52. <h2>{{#t}}Course assignments are not weighted.{{/t}}</h2>
  53. <% end %>
  54. </div>