forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroster_user.html.erb
More file actions
210 lines (204 loc) · 12 KB
/
Copy pathroster_user.html.erb
File metadata and controls
210 lines (204 loc) · 12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<%
add_crumb(t('#crumbs.people', "People"), context_url(@context, :context_users_url))
add_crumb(context_user_name(@context, @user), context_url(@context, :context_user_url, @user))
@active_tab="people"
%>
<% content_for :page_title do %><%= join_title context_user_name(@context, @user), @context.name %><% end %>
<% content_for :right_side do %>
<h2><%= t 'links.more_about_this_user', "More About This User" %></h2>
<div class="page-action-list rs-margin-bottom" id="right_nav">
<% if can_do(@membership, @current_user, :read_grades) && @membership.is_a?(StudentEnrollment) %>
<a href="<%= context_url(@context, :controller => :gradebooks, :action => :grade_summary, :id => @user.id) %>">
<i class="icon-check-plus" aria-hidden="true"></i>
<%= t 'links.user_grades', "Grades" %>
</a>
<% end %>
<% if can_do(@context, @current_user, :send_messages) %>
<a href="<%= message_user_path(@user) %>">
<i class="icon-email" aria-hidden="true"></i>
<%= t 'links.message_user', "Send Message" %>
</a>
<% end %>
<% if @domain_root_account.enable_user_notes and can_do(@user, @current_user, :read_user_notes) %>
<a href="<%= user_user_notes_path(@user) %>"> <%= t 'links.faculty_journal', "Faculty Journal" %></a>
<% end %>
<% if @context.is_a?(Course)%>
<% if @context.user_is_instructor?(@user) && can_do(@user, @current_user, :read_reports) %>
<a href="<%= user_course_teacher_activity_url(@user, @context) %>">
<i class="icon-chat" aria-hidden="true"></i>
<%= t 'links.teacher_activity', 'Student Interactions Report' %>
</a>
<% elsif @context.user_has_been_student?(@user) && @context.user_is_instructor?(@current_user) && can_do(@context, @current_user, :read_reports) %>
<%= link_to(user_student_teacher_activity_url(@current_user, @user)) do %>
<i class="icon-chat" aria-hidden="true"></i>
<%= t('Interactions Report') %>
<% end %>
<% end %>
<% end %>
<% if can_do(@context, @current_user, :read_reports) %>
<a href="<%= context_url(@context, :context_user_usage_url, @user) %>">
<i class="icon-clock" aria-hidden="true"></i>
<%= t 'links.access_report', "Access Report" %>
</a>
<% end %>
<% if @context.is_a?(Course) && @context.has_outcomes? && can_do(@context, @current_user, :manage) %>
<a href="<%= context_url(@context, :context_user_outcomes_results_url, @user.id) %>">
<i class="icon-outcomes" aria-hidden="true"></i>
<%= t "Outcomes Report" %>
</a>
<% end %>
<% if @user.grants_right?(@current_user, :view_statistics) %>
<a href="<%= user_path(@user.id) %>">
<i class="icon-user" aria-hidden="true"></i>
<%= t('links.user_account_details', %{User Account Details}) %>
</a>
<% end %>
<% roster_user_custom_links(@user).each do |link| %>
<a href="<%= link[:url] %>">
<i class="<%= link[:icon_class] %>" aria-hidden="true"></i>
<%= link[:text] %>
</a>
<% end %>
</div>
<a href="<%= user_profile_path(@current_user) %>" class="profile_url" style="display: none;"> </a>
<h2><%= t 'headings.user_services', "Registered Web Services" %></h2>
<div>
<% if can_do(@membership, @current_user, :read_services) && !@membership.user.user_services.empty? %>
<p>
<% @membership.user.user_services.each do |service| %>
<% service_name = service.service.titleize rescue 'Unknown' %>
<a href="<%= service.service_user_link %>" title="<%= service_name %>" class="no-hover"><%= image_tag "#{service.service}_icon.png", :alt => service_name %></a>
<% end %>
</p>
<% else %>
<% if !@membership.user.user_services.empty? %>
<p>
<%= t 'services_not_visible', "%{user}'s registered services are not visible to you at this time.", :user => @user.short_name %>
</p>
<% else %>
<p>
<%= t 'no_services', "%{user} hasn't linked any external services to their account yet.", :user => @user.short_name %>
</p>
<% end %>
<% end %>
<% if @current_user && @current_user == @user && @current_user.user_services.empty? %>
<p>
<%= 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.} %>
</p>
<p>
<a href="<%= user_profile_path(@current_user) %>#registered_web_services" class="btn btn-primary"><i class="icon-link"></i> <%= t('links.link_services', %{Link web services to my account}) %></a>
</p>
<% elsif @current_user && @current_user == @user && !@current_user.show_user_services %>
<p>
<%= 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.} %>
</p>
<p>
<input type="checkbox" id="show_user_services" class="show_user_services_checkbox"/><label for="show_user_services"><%= t('labels.public_list_services', %{Let fellow course/group members see which services I've linked to my profile}) %></label>
</p>
<% end %>
</div>
<% end %>
<% js_bundle :user_name %>
<% css_bundle :roster_user %>
<h1><%= @user.name %></h1>
<% can_manage_students = can_do(@context, @current_user, :manage_students) %>
<% can_manage_admins = can_do(@context, @current_user, :manage_admin_users) %>
<% if !@context.is_a?(Group) && (can_manage_students || can_manage_admins) %>
<%= render :partial => 'users/name' %>
<a href="#" class="more_user_information_link"><%= t('links.more_user_details', %{more user details...}) %></a>
<div class="more_user_information" style="display: none;">
<% if @context.is_a?(Course) %>
<fieldset>
<legend><h3><%= t('legends.memberships', %{Membership(s)}) %></h3></legend>
<table class="ic-Table">
<% @enrollments.sort_by(&:id).each do |enrollment| %>
<tr class="enrollment">
<td>
<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>
<div><%= t 'enrolled_as', "Enrolled as a %{enrollment_type}", :enrollment_type => enrollment.readable_type %></div>
<div>created <%= datetime_string(enrollment.created_at) %></div>
<% if enrollment.is_a?(ObserverEnrollment) %>
<div style="font-size: 0.8em; padding-left: 20px; <%= hidden unless enrollment.associated_user %>" class="associated_user" >
<%= t 'enrollment_linked_to', "linked to *%{linked_user}*",
:linked_user => context_user_name(@context, enrollment.associated_user),
:wrapper => '<span class="associated_user_name">\1</span>' %>
</div>
<% end %>
<div style="font-size: 0.8em; padding-left: 20px; <%= hidden unless enrollment.completed? || enrollment.inactive? %>" class="completed_at_holder">
<% if enrollment.workflow_state == 'inactive' %>
<%= t 'inactive' %>
<% elsif enrollment.completed_at %>
<%= t 'completed_enrollment', "completed *%{completed_at}*", :completed_at => datetime_string(enrollment.completed_at), :wrapper => '<span class="completed_at">\1</span>' %>
<% else %>
<%= t 'completed' %>
<% end %>
</div>
</td>
<% if enrollment.admin? ? (can_manage_admins && enrollment.user_id != @current_user.id) : can_manage_students %>
<td>
<% unless @context.completed? %>
<div class="conclude_enrollment_link_holder" style="margin-bottom: 5px; <%= hidden if enrollment.completed? %>">
<a class="conclude_enrollment_link" href="<%= context_url(@context, :controller => :courses, :action => :conclude_user, :id => enrollment.id) %>"><%= t('links.conclude_enrollment', %{Conclude this Enrollment}) %></a>
</div>
<div class="unconclude_enrollment_link_holder" style="margin-bottom: 5px; <%= hidden unless enrollment.explicitly_completed? || enrollment.inactive? %>">
<a class="unconclude_enrollment_link" href="<%= context_url(@context, :controller => :courses, :action => :unconclude_user, :id => enrollment.id) %>"><%= t('links.restore_enrollment', %{Restore this Enrollment}) %></a>
</div>
<% end %>
<div><% if enrollment.defined_by_sis? %>
<a href="#" title="<%= t('links.title.enrollment_sis_defined', %{This enrollment was defined by the university, and can't be deleted}) %>"><%= t('links.cant_delete', %{Can't Delete}) %></a>
<% else %>
<a class="delete_enrollment_link" href="<%= context_url(@context, :context_unenroll_url, enrollment.id) %>"><%= t('links.delete_enrollment', %{Delete this Enrollment}) %></a>
<% end %>
</div>
</td>
<% end %>
</tr>
<% end %>
<% if @context.is_a?(Course) && can_do(@context, @current_user, :manage_admin_users) %>
<tr>
<td>
<%= before_label('user_privileges', %{Privileges}) %>
</td>
<td>
<div class="elevate_enrollment_link_holder" style="<%= hidden if @enrollments.any?{|e| !e.limit_privileges_to_course_section } %>">
<%= t('user_only_view_section', %{this user can only view students in their assigned course section(s)}) %>
<div style="margin-left: 10px; font-size: 0.8em;">
<a href="<%= context_url(@context, :context_limit_user_grading_url, @user.id) %>" class="elevate_enrollment_link"><%= t('links.user_view_all_sections', %{let this user see all course users}) %></a>
</div>
</div>
<div class="restrict_enrollment_link_holder" style="<%= hidden unless @enrollments.any?{|e| !e.limit_privileges_to_course_section } %>">
<%= t('user_view_all_sections', %{this user can view students in any course section}) %>
<div style="margin-left: 10px; font-size: 0.8em;">
<a href="<%= context_url(@context, :context_limit_user_grading_url, @user.id) %>" class="restrict_enrollment_link"><%= t('links.user_only_view_section', %{limit this user to only see fellow section users}) %></a>
</div>
</div>
</td>
</tr>
<% end %>
</table>
</fieldset>
<%= render :partial => 'courses/link_enrollment' %>
<% end %>
<%= render :partial => 'users/logins' %>
</div>
<div style="margin-bottom: 10px;"> </div>
<% elsif service_enabled?(:avatars) %>
<div style="margin-bottom: 20px;">
<%= avatar(@user) %>
<% if can_do(@user, @current_user, :remove_avatar) %>
<a href="#" class="remove_avatar_picture_link"><%= t('links.remove_avatar', %{Remove avatar picture}) %></a>
<% else %>
<a href="<%= report_avatar_image_url(@user.id) %>" class="report_avatar_picture_link"><%= t('links.report_avatar', %{Report inappropriate picture}) %></a>
<% end %>
</div>
<% end %>
<% if @messages %>
<h2><%= t('headings.recent_messages', %{Recent Messages}) %></h2>
<%= t('no_messages', "No Messages") if @messages.empty? %>
<% @messages[0,10].each do |message| %>
<% if message.is_a?(DiscussionEntry) %>
<%= render :partial => 'discussion_topics/entry', :object => message, :locals => {:out_of_context => true, :show_context => true, :assignment_visible_to_user => message.discussion_topic.visible_for?(@current_user)} %>
<% end %>
<% end %>
<% end %>
<% js_bundle 'legacy/context_roster_user' %>