context_groups.mustache 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 %><%= join_title t(:page_title, 'Course Groups'), @context.name %><% end %>
  19. <% if !@context.is_a?(Account) %>
  20. <%
  21. js_env :course_id => @context.id,
  22. :STUDENT_CAN_ORGANIZE_GROUPS_FOR_COURSE => @context.respond_to?(:allow_student_organized_groups) && @context.allow_student_organized_groups && can_do(@context.groups.temp_record, @current_user, :create),
  23. :CAN_VIEW_PAGES => @context.grants_right?(@current_user, :view_group_pages)
  24. %>
  25. <% js_bundle :react_groups %>
  26. <% else %>
  27. <div id="group_categories_tabs" class="ui-tabs-minimal ui-tabs ui-widget ui-widget-content ui-corner-all">
  28. <ul class='collectionViewItems ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'>
  29. <li class="ui-state-default ui-corner-top"><a href="<%= context_url(@context, :context_users_url) %>">{{#t}}Everyone{{/t}}</a></li>
  30. <li class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a href="#">{{#t}}Groups{{/t}}</a></li>
  31. </ul>
  32. <div class="roster-tab tab-panel">
  33. <h2><%= @context.is_a?(Account) ? t('account_groups', 'Account Groups') : t('course_groups', 'Course Groups') %></h2>
  34. <p>
  35. <%= t 'group_explanation', <<-TEXT
  36. Groups are a good place to collaborate on projects or to figure out schedules for study sessions
  37. and the like. Every group gets a calendar, a wiki, discussions, and a little bit of space to store
  38. files. Groups can collaborate on documents, or even schedule web conferences.
  39. It's really like a mini-course where you can work with a smaller number of students on a
  40. more focused project.
  41. TEXT
  42. %>
  43. </p>
  44. <ul class="group_list">
  45. {{> views/group}}
  46. {{> views/group}}
  47. </ul>
  48. <% if @available_groups && !@available_groups.empty? %>
  49. <h2><%= t 'headings.available_groups', "Available Groups" %></h2>
  50. <ul class="group_list">
  51. {{> views/group}}
  52. </ul>
  53. <% end %>
  54. <%= form_for :group, :url => context_url(@context, :context_groups_url), :html => {:id => "add_group_form", :style => "display: none;"} do |f| %>
  55. <h2><%= t 'headings.new_group', 'Make a New Group' %></h2>
  56. <%= image_tag "warning.png", :alt => '' %>
  57. <%= t :student_group_warning, <<-TEXT
  58. If your teacher has talked about putting you into
  59. groups as part of an assignment, this is not the way to make that happen.
  60. Groups you organize yourself can't be used for grading... you can still form
  61. your own groups, but you won't be able to turn in an electric copy of any
  62. assignments unless your teacher builds the groups for you.
  63. TEXT
  64. %>
  65. <table class="formtable">
  66. <tr>
  67. <td><%= f.blabel :name, :en => "Group Name" %></td>
  68. <td><%= f.text_field :name %></td>
  69. <% if @context %>
  70. <tr>
  71. <td><%= before_label :restrictions_for_joining_groups, 'Joining' %></td>
  72. <td>
  73. <select id="group_join_level" name="group[join_level]">
  74. <option value="parent_context_auto_join"><%= t 'options.open_to_course_members', 'Course members are free to join' %></option>
  75. <%# Right now the 'parent_context_request' option isn't any different
  76. than 'parent_context_auto_join' because we're auto-accepting requested
  77. memberships. So, we're removing it until we implement an accept request
  78. feature. %>
  79. <option value="invitation_only"><%= t 'options.invite_only', 'Membership by invitation only' %></option>
  80. </select>
  81. </td>
  82. <% end %>
  83. </tr><tr>
  84. <td style="vertical-align: top;">
  85. <%= before_label :users_to_invite, 'Invite' %>
  86. </td>
  87. <td>
  88. <ul class="unstyled_list">
  89. <% (@context.users - [@current_user]).each do |user| %>
  90. <li>
  91. <%= check_box :invitees, "#{user.id}".to_sym, :value => user.id %>
  92. <%= label :invitees, "#{user.id}".to_sym, context_user_name(@context, user) %>
  93. </li>
  94. <% end %>
  95. </ul>
  96. </td>
  97. </tr><tr>
  98. <td colspan="2">
  99. <button type="submit" class="btn submit_button"><%= t 'buttons.create', 'Create Group' %></button>
  100. <button type="button" class="cancel_button btn button-secondary"><%= t '#buttons.cancel', 'Cancel' %></button>
  101. </td>
  102. </table>
  103. </div>
  104. </div>
  105. <% end %>
  106. <% end %>