new_roster_user.mustache 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. add_crumb(t('#crumbs.people', "People"), context_url(@context, :context_users_url))
  20. add_crumb(context_user_name(@context, @user), context_url(@context, :context_user_url, @user))
  21. @active_tab="people"
  22. %>
  23. <% content_for :page_title do %><%= join_title context_user_name(@context, @user), @context.name %><% end %>
  24. <% content_for :right_side do %>
  25. <div id="right_nav">
  26. <% if can_do(@membership, @current_user, :read_grades) && @membership.is_a?(StudentEnrollment) %>
  27. <a class="btn button-sidebar-wide" href="<%= context_url(@context, :controller => :gradebooks, :action => :grade_summary, :id => @user.id) %>">
  28. <i class="icon-check-plus" aria-hidden="true"></i>
  29. <%= t "Student Grades" %>
  30. </a>
  31. <% end %>
  32. <% if @domain_root_account.enable_user_notes and can_do(@user, @current_user, :read_user_notes) %>
  33. <a href="<%= user_user_notes_path(@user) %>" class="btn button-sidebar-wide">
  34. <i class="icon-note-light" aria-hidden="true"></i>
  35. <%= t "Faculty Journal" %>
  36. </a>
  37. <% end %>
  38. <% if @context.is_a?(Course)%>
  39. <% if @context.user_is_instructor?(@user) && can_do(@user, @current_user, :read_reports) %>
  40. <a href="<%= user_course_teacher_activity_url(@user, @context) %>" class="btn button-sidebar-wide">
  41. <i class="icon-chat" aria-hidden="true"></i>
  42. <%= t 'Student Interactions Report' %>
  43. </a>
  44. <% elsif @context.user_has_been_student?(@user) && @context.user_is_instructor?(@current_user) && can_do(@context, @current_user, :read_reports) %>
  45. <a href="<%= user_student_teacher_activity_url(@current_user, @user) %>" class="btn button-sidebar-wide">
  46. <i class="icon-chat" aria-hidden="true"></i>
  47. <%= t 'Interactions Report' %>
  48. </a>
  49. <% end %>
  50. <% end %>
  51. <% if can_do(@context, @current_user, :read_reports) %>
  52. <a href="<%= context_url(@context, :context_user_usage_url, @user) %>" class="btn button-sidebar-wide">
  53. <i class="icon-clock" aria-hidden="true"></i>
  54. <%= t "Access Report" %>
  55. </a>
  56. <% end %>
  57. <% if @context.is_a?(Course) && @context.has_outcomes? && can_do(@context, @current_user, :manage) %>
  58. <a href="<%= context_url(@context, :context_user_outcomes_results_url, @user.id) %>" class="btn button-sidebar-wide">
  59. <i class="icon-outcomes" aria-hidden="true"></i>
  60. <%= t "Outcomes Report" %>
  61. </a>
  62. <% end %>
  63. <% if @user.grants_right?(@current_user, :view_statistics) %>
  64. <a href="<%= user_path(@user.id) %>" class="btn button-sidebar-wide">
  65. <i class="icon-user" aria-hidden="true"></i>
  66. {{#t}}User Account Details{{/t}}
  67. </a>
  68. <% end %>
  69. <% roster_user_custom_links(@user).each do |link| %>
  70. <a href="<%= link[:url] %>" class="btn button-sidebar-wide">
  71. <i class="<%= link[:icon_class] %>" aria-hidden="true"></i>
  72. <%= link[:text] %>
  73. </a>
  74. <% end %>
  75. </div>
  76. <a href="<%= user_profile_path(@current_user) %>" class="profile_url" style="display: none;">&nbsp;</a>
  77. <% end %>
  78. <% js_bundle :user_name %>
  79. <% css_bundle :roster_user %>
  80. {{> views/shared/profile}}
  81. <% can_manage_students = can_do(@context, @current_user, :manage_students) %>
  82. <% can_manage_admins = can_do(@context, @current_user, :manage_admin_users) %>
  83. <% if !@context.is_a?(Group) && (can_manage_students || can_manage_admins) %>
  84. <div class="more_user_information">
  85. <% if @context.is_a?(Course) %>
  86. <fieldset>
  87. <legend>
  88. <h4 class="profileHeader">
  89. {{#t}}Membership(s){{/t}}
  90. </h4>
  91. </legend>
  92. <table class="ic-Table--condensed">
  93. <% @enrollments.sort_by(&:id).each do |enrollment| %>
  94. <tr id="enrollment">
  95. <td scope="row" style="width: 30%;">
  96. <a href="<%= context_url(@context, :context_section_url, enrollment.course_section_id) rescue "#" %>"><%= enrollment.try_rescue(:course_section).try_rescue(:display_name) || enrollment.short_name %></a>
  97. </td>
  98. <td style="width: 30%;">
  99. <%= t 'enrolled_as', "Enrolled as a %{enrollment_type}", :enrollment_type => enrollment.readable_type %> | created <%= datetime_string(enrollment.created_at) %>
  100. </td>
  101. <% if enrollment.is_a?(ObserverEnrollment) %>
  102. <td style="<%= hidden unless enrollment.associated_user %>" class="associated_user" >
  103. <%= t 'enrollment_linked_to', "linked to *%{linked_user}*",
  104. :linked_user => context_user_name(@context, enrollment.associated_user),
  105. :wrapper => '<span class="associated_user_name">\1</span>' %>
  106. </td>
  107. <% end %>
  108. <td style="width: 20%; <%= hidden unless enrollment.completed? %>">
  109. <p class="completed_at_holder"><%= t 'completed_enrollment', "completed *%{completed_at}*", :completed_at => datetime_string(enrollment.completed_at), :wrapper => '<span class="completed_at">\1</span>' %></p>
  110. </td>
  111. <td style="width: 10%;">
  112. <% if enrollment.admin? ? (can_manage_admins && enrollment.user_id != @current_user.id) : can_manage_students %>
  113. <% unless @context.completed? %>
  114. <p class="conclude_enrollment_link_holder" style="<%= hidden if enrollment.completed? %>">
  115. <a class="conclude_enrollment_link" href="<%= context_url(@context, :controller => :courses, :action => :conclude_user, :id => enrollment.id) %>">{{#t}}Conclude{{/t}}</a>
  116. </p>
  117. <p class="unconclude_enrollment_link_holder" style="<%= hidden unless enrollment.explicitly_completed? || enrollment.inactive? %>">
  118. <a class="unconclude_enrollment_link" href="<%= context_url(@context, :controller => :courses, :action => :unconclude_user, :id => enrollment.id) %>">{{#t}}Restore{{/t}}</a>
  119. </p>
  120. <% end %>
  121. </td>
  122. <td style="width: 10%;">
  123. <p>
  124. <% if enrollment.defined_by_sis? %>
  125. <a href="#" title="{{#t}}Can't Delete{{/t}}</a>
  126. <% else %>
  127. <a class="delete_enrollment_link" href="<%= context_url(@context, :context_unenroll_url, enrollment.id) %>">{{#t}}Delete{{/t}}</a>
  128. <% end %>
  129. </p>
  130. </td>
  131. <% end %>
  132. </tr>
  133. <% end %>
  134. <% if @context.is_a?(Course) && can_do(@context, @current_user, :manage_admin_users) %>
  135. <tr id="priveleges">
  136. <td scope="row">
  137. <%= before_label('user_privileges', %{Privileges}) %>
  138. </td>
  139. <td colspan="2">
  140. <p class="elevate_enrollment_link_holder" style="<%= hidden if @enrollments.any?{|e| !e.limit_privileges_to_course_section } %>">
  141. {{#t}}this user can only view students in their assigned course section(s){{/t}}<br/>
  142. <a href="<%= context_url(@context, :context_limit_user_grading_url, @user.id) %>" class="elevate_enrollment_link">{{#t}}let this user see all course users{{/t}}</a>
  143. </p>
  144. <p class="restrict_enrollment_link_holder" style="<%= hidden unless @enrollments.any?{|e| !e.limit_privileges_to_course_section } %>">
  145. {{#t}}this user can view students in any course section{{/t}}<br/>
  146. <a href="<%= context_url(@context, :context_limit_user_grading_url, @user.id) %>" class="restrict_enrollment_link">{{#t}}limit this user to only see fellow section users{{/t}}</a>
  147. </p>
  148. </td>
  149. </tr>
  150. <% end %>
  151. </table>
  152. </fieldset>
  153. {{> views/courses/link_enrollment}}
  154. <% end %>
  155. {{> views/users/logins}}
  156. </div>
  157. <% end %>
  158. <% js_bundle 'legacy/context_roster_user' %>