courses_right_side.mustache 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. <% if can_do @account, @current_user, :read_course_list %>
  19. <% term_count = @root_account.enrollment_terms.active.count %>
  20. <% if term_count > 1 || @associated_courses_count > 0 %>
  21. <h2>{{#t}}Course Filtering{{/t}}</h2>
  22. <div class="rs-margin-bottom">
  23. <form method="get">
  24. <% if term_count > 1 %>
  25. <label for="enrollment_term_id"><%= before_label(t(:enrollment_term_label, "Show courses from the term")) %></label><br />
  26. {{> views/shared/enrollment_term_select}}
  27. <br />
  28. <% end %>
  29. <% if @query.present? %><input name="course[name]" type="hidden" value="<%= @query %>" /><% end %>
  30. <input name="focus" type="hidden" value="filter_button"/>
  31. <input name="hide_enrollmentless_courses" type="hidden" value="0" />
  32. <input id="enroll_filter_checkbox" name="hide_enrollmentless_courses" type="checkbox" value="1" <% if params[:hide_enrollmentless_courses] == "1" %>checked="checked"<% end %>/>
  33. <label for="enroll_filter_checkbox">{{#t}}Hide enrollmentless courses{{/t}}</label>
  34. <% if master_courses? %>
  35. <br>
  36. <input id="mc_filter_checkbox" name="only_master_courses" type="checkbox" value="1" <% if params[:only_master_courses] == "1" %>checked="checked"<% end %>/>
  37. <label for="mc_filter_checkbox">{{#t}}Show only blueprint courses{{/t}}</label>
  38. <% end %>
  39. <br />
  40. <span aria-hidden="true" class="screenreader-only" id="course-sort-description">
  41. {{#t}}Sort courses{{/t}}
  42. </span>
  43. <label for="courses_sort_order">{{#t}}Sort:{{/t}}</label>
  44. <select name="courses_sort_order" aria-labelledby="course-sort-description">
  45. <% @courses_sort_orders.each do |order| %>
  46. <option value="<%= order[:key] %>" <%= "selected" if @current_user.preferences[:course_sort] == order[:key] %>>
  47. <%= order[:label].call %>
  48. </option>
  49. <% end %>
  50. </select>
  51. <br />
  52. <button id='filter_button' class='btn filter_button'>{{#t}}Filter{{/t}}</button>
  53. </form>
  54. </div>
  55. <% if @associated_courses_count > 0 %>
  56. <% js_bundle :account_search %>
  57. <h2 id="course_name_label">{{#t}}Find a Course{{/t}}</h2>
  58. <div class="rs-margin-bottom">
  59. <%= form_for :course, :url => account_courses_path(@account), :html => {:id => "new_course", :class => "ic-Form-control account_search_form", :method => :get} do |f| -%>
  60. <div class="ic-Input-group">
  61. <input name="focus" type="hidden" value="course_name"/>
  62. <input id="course_name"
  63. type="text"
  64. name="course[name]"
  65. class="ic-Input"
  66. value="<%= @query %>"
  67. data-autocomplete-source="<%= account_courses_path(@account) %>"
  68. aria-labelledby="course_name_label"
  69. />
  70. <button class='Button'>{{#t}}Go{{/t}}</button>
  71. </div>
  72. <%- end -%>
  73. </div>
  74. <% end %>
  75. <% end %>
  76. <% end %>
  77. <% js_bundle :account_show %>
  78. <% js_bundle :focus_helper %>
  79. {{> views/shared/accounts_right_side_shared}}
  80. {{> views/add_course_or_user}}