roster_user.mustache 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. <h2><%= t 'links.more_about_this_user', "More About This User" %></h2>
  26. <div class="page-action-list rs-margin-bottom" id="right_nav">
  27. <% if can_do(@membership, @current_user, :read_grades) && @membership.is_a?(StudentEnrollment) %>
  28. <a href="<%= context_url(@context, :controller => :gradebooks, :action => :grade_summary, :id => @user.id) %>">
  29. <i class="icon-check-plus" aria-hidden="true"></i>
  30. <%= t 'links.user_grades', "Grades" %>
  31. </a>
  32. <% end %>
  33. <% if can_do(@context, @current_user, :send_messages) %>
  34. <a href="<%= message_user_path(@user) %>">
  35. <i class="icon-email" aria-hidden="true"></i>
  36. <%= t 'links.message_user', "Send Message" %>
  37. </a>
  38. <% end %>
  39. <% if @domain_root_account.enable_user_notes and can_do(@user, @current_user, :read_user_notes) %>
  40. <a href="<%= user_user_notes_path(@user) %>"> <%= t 'links.faculty_journal', "Faculty Journal" %></a>
  41. <% end %>
  42. <% if @context.is_a?(Course)%>
  43. <% if @context.user_is_instructor?(@user) && can_do(@user, @current_user, :read_reports) %>
  44. <a href="<%= user_course_teacher_activity_url(@user, @context) %>">
  45. <i class="icon-chat" aria-hidden="true"></i>
  46. <%= t 'links.teacher_activity', 'Student Interactions Report' %>
  47. </a>
  48. <% elsif @context.user_has_been_student?(@user) && @context.user_is_instructor?(@current_user) && can_do(@context, @current_user, :read_reports) %>
  49. <%= link_to(user_student_teacher_activity_url(@current_user, @user)) do %>
  50. <i class="icon-chat" aria-hidden="true"></i>
  51. {{#t}}Interactions Report{{/t}}
  52. <% end %>
  53. <% end %>
  54. <% end %>
  55. <% if can_do(@context, @current_user, :read_reports) %>
  56. <a href="<%= context_url(@context, :context_user_usage_url, @user) %>">
  57. <i class="icon-clock" aria-hidden="true"></i>
  58. <%= t 'links.access_report', "Access Report" %>
  59. </a>
  60. <% end %>
  61. <% if @context.is_a?(Course) && @context.has_outcomes? && can_do(@context, @current_user, :manage) %>
  62. <a href="<%= context_url(@context, :context_user_outcomes_results_url, @user.id) %>">
  63. <i class="icon-outcomes" aria-hidden="true"></i>
  64. <%= t "Outcomes Report" %>
  65. </a>
  66. <% end %>
  67. <% if @user.grants_right?(@current_user, :view_statistics) %>
  68. <a href="<%= user_path(@user.id) %>">
  69. <i class="icon-user" aria-hidden="true"></i>
  70. {{#t}}User Account Details{{/t}}
  71. </a>
  72. <% end %>
  73. <% roster_user_custom_links(@user).each do |link| %>
  74. <a href="<%= link[:url] %>">
  75. <i class="<%= link[:icon_class] %>" aria-hidden="true"></i>
  76. <%= link[:text] %>
  77. </a>
  78. <% end %>
  79. </div>
  80. <a href="<%= user_profile_path(@current_user) %>" class="profile_url" style="display: none;">&nbsp;</a>
  81. <h2><%= t 'headings.user_services', "Registered Web Services" %></h2>
  82. <div>
  83. <% if can_do(@membership, @current_user, :read_services) && !@membership.user.user_services.empty? %>
  84. <p>
  85. <% @membership.user.user_services.each do |service| %>
  86. <% service_name = service.service.titleize rescue 'Unknown' %>
  87. <a href="<%= service.service_user_link %>" title="<%= service_name %>" class="no-hover"><%= image_tag "#{service.service}_icon.png", :alt => service_name %></a>
  88. <% end %>
  89. </p>
  90. <% else %>
  91. <% if !@membership.user.user_services.empty? %>
  92. <p>
  93. <%= t 'services_not_visible', "%{user}'s registered services are not visible to you at this time.", :user => @user.short_name %>
  94. </p>
  95. <% else %>
  96. <p>
  97. <%= t 'no_services', "%{user} hasn't linked any external services to their account yet.", :user => @user.short_name %>
  98. </p>
  99. <% end %>
  100. <% end %>
  101. <% if @current_user && @current_user == @user && @current_user.user_services.empty? %>
  102. <p>
  103. <%= t 'help.services', %{You haven't linked your user profile to any external services. You can link your Canvas account to services like Twitter. This will make it easier for fellow course and group members to link up with you outside of class.} %>
  104. </p>
  105. <p>
  106. <a href="<%= user_profile_path(@current_user) %>#registered_web_services" class="btn btn-primary"><i class="icon-link"></i> {{#t}}Link web services to my account{{/t}}</a>
  107. </p>
  108. <% elsif @current_user && @current_user == @user && !@current_user.show_user_services %>
  109. <p>
  110. <%= t 'help.list_services', %{You haven't enabled your list of registered services. Enabling this list will let fellow course and group members more easily link up with you outside of class.} %>
  111. </p>
  112. <p>
  113. <input type="checkbox" id="show_user_services" class="show_user_services_checkbox"/><label for="show_user_services">{{#t}}Let fellow course/group members see which services I've linked to my profile{{/t}}</label>
  114. </p>
  115. <% end %>
  116. </div>
  117. <% end %>
  118. <% js_bundle :user_name %>
  119. <% css_bundle :roster_user %>
  120. <h1><%= @user.name %></h1>
  121. <% can_manage_students = can_do(@context, @current_user, :manage_students) %>
  122. <% can_manage_admins = can_do(@context, @current_user, :manage_admin_users) %>
  123. <% if !@context.is_a?(Group) && (can_manage_students || can_manage_admins) %>
  124. {{> views/users/name}}
  125. <a href="#" class="more_user_information_link">{{#t}}more user details...{{/t}}</a>
  126. <div class="more_user_information" style="display: none;">
  127. <% if @context.is_a?(Course) %>
  128. <fieldset>
  129. <legend><h3>{{#t}}Membership(s){{/t}}</h3></legend>
  130. <table class="ic-Table">
  131. <% @enrollments.sort_by(&:id).each do |enrollment| %>
  132. <tr class="enrollment">
  133. <td>
  134. <b><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></b>
  135. <div><%= t 'enrolled_as', "Enrolled as a %{enrollment_type}", :enrollment_type => enrollment.readable_type %></div>
  136. <div>created <%= datetime_string(enrollment.created_at) %></div>
  137. <% if enrollment.is_a?(ObserverEnrollment) %>
  138. <div style="font-size: 0.8em; padding-left: 20px; <%= hidden unless enrollment.associated_user %>" class="associated_user" >
  139. <%= t 'enrollment_linked_to', "linked to *%{linked_user}*",
  140. :linked_user => context_user_name(@context, enrollment.associated_user),
  141. :wrapper => '<span class="associated_user_name">\1</span>' %>
  142. </div>
  143. <% end %>
  144. <div style="font-size: 0.8em; padding-left: 20px; <%= hidden unless enrollment.completed? || enrollment.inactive? %>" class="completed_at_holder">
  145. <% if enrollment.workflow_state == 'inactive' %>
  146. <%= t 'inactive' %>
  147. <% elsif enrollment.completed_at %>
  148. <%= t 'completed_enrollment', "completed *%{completed_at}*", :completed_at => datetime_string(enrollment.completed_at), :wrapper => '<span class="completed_at">\1</span>' %>
  149. <% else %>
  150. <%= t 'completed' %>
  151. <% end %>
  152. </div>
  153. </td>
  154. <% if enrollment.admin? ? (can_manage_admins && enrollment.user_id != @current_user.id) : can_manage_students %>
  155. <td>
  156. <% unless @context.completed? %>
  157. <div class="conclude_enrollment_link_holder" style="margin-bottom: 5px; <%= hidden if enrollment.completed? %>">
  158. <a class="conclude_enrollment_link" href="<%= context_url(@context, :controller => :courses, :action => :conclude_user, :id => enrollment.id) %>">{{#t}}Conclude this Enrollment{{/t}}</a>
  159. </div>
  160. <div class="unconclude_enrollment_link_holder" style="margin-bottom: 5px; <%= hidden unless enrollment.explicitly_completed? || enrollment.inactive? %>">
  161. <a class="unconclude_enrollment_link" href="<%= context_url(@context, :controller => :courses, :action => :unconclude_user, :id => enrollment.id) %>">{{#t}}Restore this Enrollment{{/t}}</a>
  162. </div>
  163. <% end %>
  164. <div><% if enrollment.defined_by_sis? %>
  165. <a href="#" title="{{#t}}Can't Delete{{/t}}</a>
  166. <% else %>
  167. <a class="delete_enrollment_link" href="<%= context_url(@context, :context_unenroll_url, enrollment.id) %>">{{#t}}Delete this Enrollment{{/t}}</a>
  168. <% end %>
  169. </div>
  170. </td>
  171. <% end %>
  172. </tr>
  173. <% end %>
  174. <% if @context.is_a?(Course) && can_do(@context, @current_user, :manage_admin_users) %>
  175. <tr>
  176. <td>
  177. <%= before_label('user_privileges', %{Privileges}) %>
  178. </td>
  179. <td>
  180. <div class="elevate_enrollment_link_holder" style="<%= hidden if @enrollments.any?{|e| !e.limit_privileges_to_course_section } %>">
  181. {{#t}}this user can only view students in their assigned course section(s){{/t}}
  182. <div style="margin-left: 10px; font-size: 0.8em;">
  183. <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>
  184. </div>
  185. </div>
  186. <div class="restrict_enrollment_link_holder" style="<%= hidden unless @enrollments.any?{|e| !e.limit_privileges_to_course_section } %>">
  187. {{#t}}this user can view students in any course section{{/t}}
  188. <div style="margin-left: 10px; font-size: 0.8em;">
  189. <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>
  190. </div>
  191. </div>
  192. </td>
  193. </tr>
  194. <% end %>
  195. </table>
  196. </fieldset>
  197. {{> views/courses/link_enrollment}}
  198. <% end %>
  199. {{> views/users/logins}}
  200. </div>
  201. <div style="margin-bottom: 10px;">&nbsp;</div>
  202. <% elsif service_enabled?(:avatars) %>
  203. <div style="margin-bottom: 20px;">
  204. <%= avatar(@user) %>
  205. <% if can_do(@user, @current_user, :remove_avatar) %>
  206. <a href="#" class="remove_avatar_picture_link">{{#t}}Remove avatar picture{{/t}}</a>
  207. <% else %>
  208. <a href="<%= report_avatar_image_url(@user.id) %>" class="report_avatar_picture_link">{{#t}}Report inappropriate picture{{/t}}</a>
  209. <% end %>
  210. </div>
  211. <% end %>
  212. <% if @messages %>
  213. <h2>{{#t}}Recent Messages{{/t}}</h2>
  214. <%= t('no_messages', "No Messages") if @messages.empty? %>
  215. <% @messages[0,10].each do |message| %>
  216. <% if message.is_a?(DiscussionEntry) %>
  217. {{> views/discussion_topics/entry}}
  218. <% end %>
  219. <% end %>
  220. <% end %>
  221. <% js_bundle 'legacy/context_roster_user' %>