show.mustache 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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 %><%= @section.name %><% end %>
  19. <% content_for :right_side do %>
  20. <% if can_do(@section, @current_user, :update) %>
  21. <a href="#" class="btn button-sidebar-wide edit_section_link"><i class="icon-edit"></i> {{#t}}Edit Section{{/t}}</a>
  22. <% if @section.nonxlist_course_id %>
  23. <% if can_do(@section.nonxlist_course, @current_user, :manage_sections) %>
  24. <a href="#" class="btn button-sidebar-wide uncrosslist_link"><i class="icon-off"></i> {{#t}}De-Cross-List this Section{{/t}}</a>
  25. <% end %>
  26. <a href="#" class="btn button-sidebar-wide crosslist_link"><i class="icon-off"></i> {{#t}}Re-Cross-List this Section{{/t}}</a>
  27. <% else %>
  28. <a href="#" class="btn button-sidebar-wide crosslist_link"><i class="icon-off"></i> {{#t}}Cross-List this Section{{/t}}</a>
  29. <% end %>
  30. <% end %>
  31. <a href="<%= context_url(@context, :context_settings_url) %>" class="btn button-sidebar-wide"><i class="icon-settings"></i> {{#t}}Back to Course Settings{{/t}}</a>
  32. <% end %>
  33. <% content_for :stylesheets do %>
  34. <style>
  35. #course_form .course_form {
  36. display: none;
  37. }
  38. #course_form.editing .course_form {
  39. display: inline;
  40. }
  41. #course_form.editing .course_info {
  42. display: none;
  43. }
  44. #course_form .date_entry {
  45. width: 100px;
  46. }
  47. .user-list-wrapper {
  48. margin-bottom: 32px;
  49. min-height: 32px;
  50. position: relative;
  51. }
  52. ul.user_list {
  53. list-style: none;
  54. padding-left: 0px;
  55. margin-top: 0px;
  56. max-width: 400px;
  57. }
  58. ul.user_list li.user {
  59. padding-left: 10px;
  60. color: #444;
  61. line-height: 1.5em;
  62. -moz-border-radius: 5px;
  63. }
  64. ul.user_list li.user:hover {
  65. background-color: #eee;
  66. }
  67. ul.user_list li.user .email {
  68. font-size: 0.8em;
  69. margin: -5px 10px 5px;
  70. }
  71. ul.user_list li.user .section {
  72. font-size: 0.8em;
  73. margin: -5px 10px 5px;
  74. }
  75. ul.user_list li.user .short_name {
  76. font-size: 0.8em;
  77. margin: -2px 10px 0px;
  78. }
  79. ul.user_list li.user .enrollment_type {
  80. font-size: 0.8em;
  81. margin: -2px 10px 0px;
  82. }
  83. ul.user_list li.user .links {
  84. float: right;
  85. padding-right: 20px;
  86. padding-top: 5px;
  87. visibility: hidden;
  88. }
  89. ul.user_list li.user .links a {
  90. text-decoration: none;
  91. }
  92. ul.user_list li.user:hover .links {
  93. float: right;
  94. padding-right: 20px;
  95. visibility: visible;
  96. }
  97. ul.user_list li.user.pending {
  98. color: #888;
  99. font-style: italic;
  100. }
  101. h3 .tally {
  102. font-family: arial,sans-serif;
  103. font-size: 12px;
  104. padding-left: 5px;
  105. }
  106. .associated_user {
  107. display: none;
  108. }
  109. #edit_section_form {
  110. margin-bottom: 20px;
  111. }
  112. #edit_section_form .form-actions {
  113. background: none;
  114. border: 0;
  115. padding: 0;
  116. text-align: left;
  117. }
  118. </style>
  119. <% end %>
  120. <%= form_for @section, :url => context_url(@context, :context_section_url, @section), :html => {:id => "edit_section_form", :style => "display: none;"} do |f| %>
  121. <table class="formtable">
  122. <tr>
  123. <td><%= f.blabel :name, :en => "Section Name" %></td>
  124. <td><%= f.text_field :name %></td>
  125. </tr>
  126. <% if @section.sis_source_id && can_do(@context, @current_user, :read_sis) || can_do(@context, @current_user, :manage_sis) %>
  127. <tr>
  128. <td><%= f.blabel :sis_source_id, :en => "SIS ID" %></td>
  129. <td>
  130. <span class="course_form">
  131. <% if can_do(@context, @current_user, :manage_sis) %>
  132. <%= f.text_field :sis_source_id, :style => "width: 50px;", :title => "SIS ID", :value => @section.sis_source_id %>
  133. <% else %>
  134. <%= @section.sis_source_id %>
  135. <% end %>
  136. </span>
  137. </td>
  138. </tr>
  139. <% end %>
  140. <tr>
  141. <td>
  142. <%= f.blabel :start_at, en: "Starts" %>
  143. <label class="screenreader-only" id="section_starts_at_label">
  144. {{#t}}Section starts at{{/t}}
  145. <%= datepicker_screenreader_prompt %>
  146. </label>
  147. </td>
  148. <td>
  149. <%= f.text_field :start_at,
  150. class: "datetime_field",
  151. value: datetime_string(@section.start_at),
  152. style: 'width: 120px;',
  153. "aria-labelledby" => "section_starts_at_label",
  154. "data-tooltip" => "",
  155. title: accessible_date_format %>
  156. </td>
  157. </tr>
  158. <tr>
  159. <td>
  160. <%= f.blabel :end_at, en: "Ends" %>
  161. <label class="screenreader-only" id="section_ends_at_label">
  162. {{#t}}Section ends at{{/t}}
  163. <%= datepicker_screenreader_prompt %>
  164. </label>
  165. </td>
  166. <td>
  167. <%= f.text_field :end_at,
  168. class: "datetime_field",
  169. value: datetime_string(@section.end_at),
  170. style: 'width: 120px;',
  171. "aria-labelledby" => "section_ends_at_label",
  172. "data-tooltip" => "",
  173. title: accessible_date_format %>
  174. </td>
  175. </tr>
  176. <tr>
  177. <td colspan="2">
  178. <%= f.check_box :restrict_enrollments_to_section_dates %>
  179. <%= f.label :restrict_enrollments_to_section_dates, t('access_limit', "Users can only participate in the course between these dates") %>
  180. <div style="font-size: 0.8em; padding-left: 25px;">
  181. {{#t}}This will override any term or course date settings.{{/t}}
  182. </div>
  183. </td>
  184. </tr>
  185. <tr>
  186. <td colspan="2">
  187. <div class="form-actions">
  188. <button type="button" class="btn cancel_button button-secondary">{{#t}}Cancel{{/t}}</button>
  189. <button type="submit" class="btn btn-primary submit_button">{{#t}}Update Section{{/t}}</button>
  190. </div>
  191. </td>
  192. </tr>
  193. </table>
  194. <% end %>
  195. <h2 id="section_name"><%= @section.name %></h2>
  196. <div style="margin-bottom: 20px;">
  197. <div id="enrollments_div">
  198. <table id="enrollment_table">
  199. <% if @pending_enrollments_count > 0 %>
  200. <tr>
  201. <td class="pending_enrollments"><%= t('pending_enrollment', {:one => '1 Pending Enrollment', :other => '%{count} Pending Enrollments'}, :count => @pending_enrollments_count) %></td>
  202. </tr>
  203. <% end %>
  204. <% if @enrollments_count > 0 %>
  205. <tr>
  206. <td class="active_enrollments"><%= t('active_enrollment', {:one => '1 Active Enrollment', :other => '%{count} Active Enrollments'}, :count => @enrollments_count) %></td>
  207. </tr>
  208. <% end %>
  209. <% if @completed_enrollments_count > 0 %>
  210. <tr>
  211. <td class="completed_enrollments"><%= t('completed_enrollment', {:one => '1 Completed Enrollment', :other => '%{count} Completed Enrollments'}, :count => @completed_enrollments_count) %></td>
  212. </tr>
  213. <% end %>
  214. </table>
  215. </div>
  216. <% if @section && ( @section.sis_source_id && can_do(@context, @current_user, :read_sis) || can_do(@context, @current_user, :manage_sis))%>
  217. <div><%= before_label('sis_id', "SIS ID") %> <span class="sis_source_id"><%= @section.sis_source_id %></span></div>
  218. <% end %>
  219. <% if @section.start_at || @section.end_at %>
  220. <div>
  221. <% if @section.start_at && @section.end_at %>
  222. <%= t('run_dates', 'Runs from %{start_date} to %{end_date}', :start_date => friendly_datetime(@section.start_at, context: @context).html_safe, :end_date => friendly_datetime(@section.end_at, context: @context).html_safe) %>
  223. <% elsif @section.end_at %>
  224. <%= t('runs_until', 'Runs until %{end_date}', :end_date => friendly_datetime(@section.end_at, context: @context).html_safe) %>
  225. <% elsif @section.start_at %>
  226. <%= t('run_from', 'Runs from %{start_date} with no end date', :start_date => friendly_datetime(@section.start_at, context: @context).html_safe) %>
  227. <% end %>
  228. </div>
  229. <div style="margin-left: 10px; font-size: 0.8em;">
  230. <%= t('Students can only participate in the course between these dates') if @section.restrict_enrollments_to_section_dates %>
  231. </div>
  232. <% end %>
  233. </div>
  234. <% if can_do @context, @current_user, :read_roster, :manage_students, :manage_admin_users %>
  235. <div class="enrollments-lists">
  236. <h3>{{#t}}Current Enrollments{{/t}}</h3>
  237. <div class="user-list-wrapper" id="current-enrollment-list">
  238. <ul class="user_list"></ul>
  239. </div>
  240. <h3>{{#t}}Completed Enrollments{{/t}}</h3>
  241. <div class="user-list-wrapper" id="completed-enrollment-list">
  242. <ul class="user_list"></ul>
  243. </div>
  244. </div>
  245. <% end %>
  246. <% js_bundle :section %>
  247. <div style="display: none;">
  248. <%= form_tag context_url(@context, :context_section_crosslist_url, @section.id), :id => "crosslist_course_form", :class => "form-dialog no-margin-bottom", :title => t('titles.crosslist_this_section', 'Cross-List this Section'), :method => :post do %>
  249. <h2>{{#t}}Cross-List Section{{/t}}</h2>
  250. <p>
  251. <%= t('crosslist_description', %{
  252. Cross-listing allows you to create a section in one account and
  253. then move it to a course on a different account.
  254. To cross-list this course, you'll need to find the course you
  255. want to move it to, either using the search tool or by
  256. entering the course's ID. }) %>
  257. </p>
  258. <table class="formtable">
  259. <tr>
  260. <td><label for="course_autocomplete_id_lookup"><%= before_label('search_for_course', "Search for Course") %> </label></td>
  261. <td>
  262. <a href="<%= context_url(@current_user, :context_manageable_courses_url, :format => :json) %>" id="course_autocomplete_url" style="display: none;">&nbsp;</a>
  263. <a href="<%= context_url(@context, :context_section_confirm_crosslist_url, @section.id, "{{ id }}") %>" id="course_confirm_crosslist_url" style="display: none;">&nbsp;</a>
  264. <input type="hidden" name="new_course_id" id="course_autocomplete_id"/>
  265. <input type="text" id="course_autocomplete_id_lookup" style="width: 250px;"/>
  266. </td>
  267. </tr><tr>
  268. <td><label for="course_id"><%= before_label('enter_course_id', "Or Enter the Course's ID") %></label></td>
  269. <td>
  270. <input type="text" id="course_id" style="width: 75px;"/>
  271. </td>
  272. </tr><tr>
  273. <td colspan="2">
  274. <div id="course_autocomplete_name_holder" style="margin-top: 20px;">
  275. <%= before_label('labels.selected_course', 'Selected Course') %>
  276. <div style="margin-left: 20px;">
  277. <div id="course_autocomplete_name" style="font-weight: bold;"></div>
  278. <div id="sis_id_holder" style="display: none;"><%= before_label('labels.sis_id', 'SIS ID') %> <span class="sis_id">&nbsp;</span></div>
  279. <div id="account_name_holder" style="display: none;"><%= before_label('labels.account', 'Account') %> <span class="account_name"></span></div>
  280. </div>
  281. </div>
  282. </td>
  283. </tr>
  284. </table>
  285. <div class="form-controls">
  286. <button type="submit" class="btn btn-primary submit_button">{{#t}}Cross-List This Section{{/t}}</button>
  287. <button type="button" class="btn button-secondary cancel_button">{{#t}}Cancel{{/t}}</button>
  288. </div>
  289. <% end %>
  290. <%= form_tag context_url(@context, :context_section_uncrosslist_url, @section.id), :id => "uncrosslist_form", :title => t('titles.decrosslist_section', 'De-Cross-List this Section'), :method => :delete do %>
  291. <h2>{{#t}}De-Cross-List this Section{{/t}}</h2>
  292. <p>
  293. {{#t}}Are you sure you want to de-cross-list this section?{{/t}}
  294. <% if @section.nonxlist_course %>
  295. <%= mt('decrosslist_description', 'This will move the section back to its original course, **%{course_name}**.', :course_name => @section.nonxlist_course.name) %>
  296. <% end %>
  297. </p>
  298. <% if @student_enrollments_count > 0 %>
  299. <p>
  300. <%= t('decrosslist_long_description', %{
  301. All grades for students in this course will no longer be visible.
  302. You can retrieve the grades later by re-cross-listing the course,
  303. but in the mean time the grades for these students will come from the original course.
  304. }) %>
  305. </p>
  306. <% end %>
  307. <div class="button-container">
  308. <button type="submit" class="btn submit_button">{{#t}}De-Cross-List This Section{{/t}}</button>
  309. <button type="button" class="btn btn button-secondary cancel_button">{{#t}}Cancel{{/t}}</button>
  310. </div>
  311. <% end %>
  312. </div>