index.mustache 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. <% content_for :page_title do %><%= t '#crumbs.groups', 'Groups' %><% end %>
  19. <% add_crumb t('#crumbs.groups', 'Groups') %>
  20. <% content_for :right_side do %>
  21. <% end %>
  22. <% css_bundle :course_list %>
  23. <h2><%= t :heading_current_groups, 'Current Groups' %></h2>
  24. <% if @current_groups.empty? %>
  25. {{#t}}No Groups{{/t}}
  26. <% else %>
  27. <table id="my_groups_table" class="ic-Table ic-Table--bordered">
  28. <thead>
  29. <tr>
  30. <th scope="col" class="course-list-group-column">{{#t}}Group{{/t}}</th>
  31. <th scope="col" class="course-list-course-title-column course-list-no-left-border">{{#t}}Course{{/t}}</th>
  32. <th scope="col" class="course-list-term-column course-list-no-left-border">{{#t}}Term{{/t}}</th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. <% @current_groups.each do |group| %>
  37. <tr>
  38. <td>
  39. <%= link_to group.name, group_path(group) %>
  40. </td>
  41. <td class="course-list-no-left-border">
  42. <span class="group-course-name"><%= group.context.name %></span>
  43. </td>
  44. <td class="course-list-no-left-border">
  45. <% if group.context_type == 'Course' && !group.context.enrollment_term.default_term? %>
  46. <%= group.context.enrollment_term.name %>
  47. <% end %>
  48. </td>
  49. </tr>
  50. <% end %>
  51. </tbody>
  52. </table>
  53. <% end %>
  54. <h2><%= t :heading_previous_groups, 'Previous Groups' %></h2>
  55. <% if @previous_groups.empty? %>
  56. {{#t}}No Groups{{/t}}
  57. <% else %>
  58. <table id="my_groups_table" class="ic-Table ic-Table--bordered">
  59. <thead>
  60. <tr>
  61. <th scope="col" class="course-list-group-column">{{#t}}Group{{/t}}</th>
  62. <th scope="col" class="course-list-course-title-column course-list-no-left-border">{{#t}}Course{{/t}}</th>
  63. <th scope="col" class="course-list-term-column course-list-no-left-border">{{#t}}Term{{/t}}</th>
  64. </tr>
  65. </thead>
  66. <% @previous_groups.each do |group| %>
  67. <tr>
  68. <td>
  69. <%# Only show a link if the user can read the group - they'll get a permissions error page if they try to %>
  70. <%# hit the link otherwise %>
  71. <% if group.grants_right?(@current_user, session, :read) %>
  72. <%= link_to group.name, group_path(group) %>
  73. <% else %>
  74. <%= group.name %>
  75. <% end %>
  76. </td>
  77. <td>
  78. <%= group.context.name %>
  79. </td>
  80. <td>
  81. <% if group.context_type == 'Course' && !group.context.enrollment_term.default_term? %>
  82. <% else %>
  83. <%= group.context.enrollment_term.name %>
  84. <% end %>
  85. </td>
  86. </tr>
  87. <% end %>
  88. </table>
  89. <% end %>