add_course_or_user.mustache 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. <%
  19. hide_add_course ||= false; hide_add_user ||= false
  20. show_course = !hide_add_course && can_do(@account, @current_user, :manage_courses)
  21. show_user = !hide_add_user && @account.root_account? && can_do(@account, @current_user, :manage_user_logins)
  22. %>
  23. <div class="rs-margin-bottom">
  24. <% if show_course %>
  25. <a href="#" role="button" class="add_course_link Button button-sidebar-wide">
  26. <span aria-hidden="true"><i class="icon-plus"></i> {{#t}}New Course{{/t}}</span>
  27. </a>
  28. <% end %>
  29. <% if show_user %>
  30. <a href="#" role="button" class="add_user_link Button button-sidebar-wide" aria-label="{{#t}}Add a New User{{/t}}">
  31. <span aria-hidden="true"><i class="icon-plus"></i> {{#t}}New User{{/t}}</span>
  32. </a>
  33. <% end %>
  34. <% account_custom_links.each do |link| %>
  35. <a href="<%= link[:url] %>" role="button" class="Button button-sidebar-wide"><i class="<%= link[:icon_class] %>" role="presentation"></i> <%= link[:text] %></a>
  36. <% end %>
  37. </div>
  38. <% if show_course || show_user %>
  39. <div style="display: none;">
  40. <div id="current_enrollment_term_id"><%= @term && @term.id %></div>
  41. <div id="add_user_dialog">
  42. <%= form_for :user, :url => account_add_user_url(@account), :html => {:id => "add_user_form"} do |f| %>
  43. <table class="formtable">
  44. <tr>
  45. <td><%= f.blabel :name, :full_name, :en => "Full Name" %></td>
  46. <td>
  47. <%= f.text_field :name %>
  48. <div class="hint-text"><%= t :full_name_description, 'This name will be used by teachers for grading.' %></div>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td><%= f.blabel :short_name, :en => "Display Name" %></td>
  53. <td>
  54. <%= f.text_field :short_name %>
  55. <div class="hint-text">{{#t}}People will see this name in discussions, messages and comments.{{/t}}</div>
  56. </td>
  57. </tr>
  58. <tr>
  59. <td><%= f.blabel :sortable_name, :en => "Sortable Name" %></td>
  60. <td>
  61. <%= f.text_field :sortable_name %>
  62. <div class="hint-text">{{#t}}This name appears in sorted lists.{{/t}}</div>
  63. </td>
  64. </tr>
  65. <% if @root_account.login_handle_name_is_customized? || @root_account.delegated_authentication? %>
  66. <tr>
  67. <td><%= blabel :pseudonym, :path, :en => "Email" %></td>
  68. <td><%= text_field :pseudonym, :path %></td>
  69. </tr>
  70. <% end %>
  71. <tr>
  72. <td>
  73. <label for="pseudonym_unique_id">
  74. <%= t(:unique_id_label_1, "%{label}:", label: @root_account.login_handle_name_with_inference) %>
  75. </label>
  76. </td>
  77. <td><%= text_field :pseudonym, :unique_id %></td>
  78. </tr>
  79. <% if @root_account.allow_sis_import && can_do(@root_account, @current_user, :manage_sis) %>
  80. <tr>
  81. <td><%= blabel :pseudonym, :sis_user_id, :en => "SIS ID" %></td>
  82. <td><%= text_field :pseudonym, :sis_user_id %></td>
  83. </tr>
  84. <% end %>
  85. <tr>
  86. <td colspan="2">
  87. <%= check_box :pseudonym, :send_confirmation, :checked => true %>
  88. &nbsp;<%= label :pseudonym, :send_confirmation, :en => "Email the user about this account creation" %>
  89. </td>
  90. </tr>
  91. <tr>
  92. <td colspan="2">
  93. <div class="button-container">
  94. <button type="button" class="btn cancel_button">{{#t}}Cancel{{/t}}</button>
  95. <button type="submit" class="btn btn-primary submit_button">{{#t}}Add User{{/t}}</button>
  96. </div>
  97. </td>
  98. </tr>
  99. </table>
  100. <% end %>
  101. </div>
  102. <div id="add_course_dialog">
  103. <%= form_for :course, :url => courses_url, :html => {:id => "add_course_form"} do |f| %>
  104. <input type="hidden" name="account_id" value="<%= @account.id %>"/>
  105. <table class="formtable">
  106. <tr>
  107. <td><%= f.blabel :name, :en => "Course Name" %></td>
  108. <td><%= f.text_field :name, :style => "width: 200px;" %></td>
  109. </tr><tr>
  110. <td><%= f.blabel :course_code, :en => "Reference Code" %></td>
  111. <td><%= f.text_field :course_code, :style => "width: 100px;" %></td>
  112. </tr><tr>
  113. <td><%= f.blabel :account_id, :en => "Subaccount" %></td>
  114. <td><%= f.select :account_id, @account.sub_accounts_as_options, :selected => @term && @term.id %></td>
  115. </tr><tr>
  116. <td><%= f.label :enrollment_term_id, :en => "Enrollment Term" %></td>
  117. <td>{{> views/shared/enrollment_term_select}}
  118. </tr><tr>
  119. <td colspan="2">
  120. <div class="button-container">
  121. <button type="button" class="btn dialog_closer">{{#t}}Cancel{{/t}}</button>
  122. <button type="submit" class="btn btn-primary">{{#t}}Add Course{{/t}}</button>
  123. </div>
  124. </td>
  125. </tr>
  126. </table>
  127. <% end %>
  128. </div>
  129. </div>
  130. <% js_bundle :add_course_or_user %>
  131. <% end %>