<commit_before><%
  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" 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"></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"></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) %>
        <%= link_to(t('links.teacher_activity', 'Student Interactions Report'), user_course_teacher_activity_url(@user, @context)) %>
      <% 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-peer-review"></i>
          <%= t('links.student_teacher_activity', 'Interactions with You') %>
        <% 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"></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-star"></i> <%= t 'links.user_outcomes', "Outcomes" %></a>
    <% end %>
    <% if can_do(@domain_root_account, @current_user, :manage) %>
      <a href="<%= user_path(@user.id) %>"><i class="icon-user"></i> <%= t('links.user_account_details', %{User Account Details}) %></a>
    <% end %>
  </div>
  <a href="<%= user_profile_path(@current_user) %>" class="profile_url" style="display: none;">&nbsp;</a>
  <h2><%= t 'headings.user_services', "Registered Web Services" %></h2>
  <div class="rs-margin-lr">
    <% if can_do(@membership, @current_user, :read_services) && !@membership.user.user_services.empty? %>
      <p>
      <% @membership.user.user_services.each do |service| %>
        <a href="<%= service.service_user_link %>" title="<%= service.service.titleize rescue 'Unknown' %>" class="no-hover"><%= image_tag "#{service.service}_icon.png" %></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 Facebook and 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 %>
<% jammit_css :roster_user %>

<h1><%= @user.name %></h1>
<% if can_do(@context, @current_user, :manage_students) && !@context.is_a?(Group)%>
<%= 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><%= t('legends.memberships', %{Membership(s)}) %></legend>
      <table>
        <% @enrollments.sort_by(&:id).each do |enrollment| %>
          <tr class="enrollment">
            <td style="vertical-align: top; padding: 5px 50px 5px 5px;">
              <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 style="font-size: 0.8em; padding-left: 20px;"><%= t 'enrolled_as', "Enrolled as a %{enrollment_type}", :enrollment_type => enrollment.readable_type %></div>
              <div style="font-size: 0.8em; padding-left: 20px;">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? %>" class="completed_at_holder"><%= t 'completed_enrollment', "completed *%{completed_at}*", :completed_at => datetime_string(enrollment.completed_at), :wrapper => '<span class="completed_at">\1</span>' %></div>
            </td>
            <% if !enrollment.admin? || (can_do(@context, @current_user, :manage_admin_users) && enrollment.user_id != @current_user.id) %>
              <td style="vertical-align: top; padding: 5px; font-size: 0.8em;">
                <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? %>">
                  <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>
                <% if can_do(@context, @current_user, :manage_admin_users) && enrollment.is_a?(ObserverEnrollment) %>
                  <div class="link_enrollment_link_holder" style="margin-bottom: 5px;">
                    <a class="link_enrollment_link" href="#" data-id="<%= enrollment.id %>" data-associated-id="<%= enrollment.associated_user_id %>"><%= t('links.link_enrollment', %{Link 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 style="border-top: 1px solid #eee; padding-top: 5px; vertical-align: top; font-weight: bold;"><%= before_label('user_privileges', %{Privileges}) %></td>
            <td style="border-top: 1px solid #eee; padding-top: 5px;">
              <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;">&nbsp;</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="#" class="report_avatar_picture_link"><%= t('links.report_avatar', %{Report inappropriate picture}) %></a>
    <% end %>
  </div>
<% end %>

<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} %>
  <% end %>
<% end %>

<% js_bundle 'legacy/context_roster_user' %><commit_msg>fix roster user partial rendering<commit_after><%
  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" 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"></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"></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) %>
        <%= link_to(t('links.teacher_activity', 'Student Interactions Report'), user_course_teacher_activity_url(@user, @context)) %>
      <% 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-peer-review"></i>
          <%= t('links.student_teacher_activity', 'Interactions with You') %>
        <% 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"></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-star"></i> <%= t 'links.user_outcomes', "Outcomes" %></a>
    <% end %>
    <% if can_do(@domain_root_account, @current_user, :manage) %>
      <a href="<%= user_path(@user.id) %>"><i class="icon-user"></i> <%= t('links.user_account_details', %{User Account Details}) %></a>
    <% end %>
  </div>
  <a href="<%= user_profile_path(@current_user) %>" class="profile_url" style="display: none;">&nbsp;</a>
  <h2><%= t 'headings.user_services', "Registered Web Services" %></h2>
  <div class="rs-margin-lr">
    <% if can_do(@membership, @current_user, :read_services) && !@membership.user.user_services.empty? %>
      <p>
      <% @membership.user.user_services.each do |service| %>
        <a href="<%= service.service_user_link %>" title="<%= service.service.titleize rescue 'Unknown' %>" class="no-hover"><%= image_tag "#{service.service}_icon.png" %></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 Facebook and 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 %>
<% jammit_css :roster_user %>

<h1><%= @user.name %></h1>
<% if can_do(@context, @current_user, :manage_students) && !@context.is_a?(Group)%>
<%= 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><%= t('legends.memberships', %{Membership(s)}) %></legend>
      <table>
        <% @enrollments.sort_by(&:id).each do |enrollment| %>
          <tr class="enrollment">
            <td style="vertical-align: top; padding: 5px 50px 5px 5px;">
              <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 style="font-size: 0.8em; padding-left: 20px;"><%= t 'enrolled_as', "Enrolled as a %{enrollment_type}", :enrollment_type => enrollment.readable_type %></div>
              <div style="font-size: 0.8em; padding-left: 20px;">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? %>" class="completed_at_holder"><%= t 'completed_enrollment', "completed *%{completed_at}*", :completed_at => datetime_string(enrollment.completed_at), :wrapper => '<span class="completed_at">\1</span>' %></div>
            </td>
            <% if !enrollment.admin? || (can_do(@context, @current_user, :manage_admin_users) && enrollment.user_id != @current_user.id) %>
              <td style="vertical-align: top; padding: 5px; font-size: 0.8em;">
                <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? %>">
                  <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>
                <% if can_do(@context, @current_user, :manage_admin_users) && enrollment.is_a?(ObserverEnrollment) %>
                  <div class="link_enrollment_link_holder" style="margin-bottom: 5px;">
                    <a class="link_enrollment_link" href="#" data-id="<%= enrollment.id %>" data-associated-id="<%= enrollment.associated_user_id %>"><%= t('links.link_enrollment', %{Link 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 style="border-top: 1px solid #eee; padding-top: 5px; vertical-align: top; font-weight: bold;"><%= before_label('user_privileges', %{Privileges}) %></td>
            <td style="border-top: 1px solid #eee; padding-top: 5px;">
              <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;">&nbsp;</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="#" class="report_avatar_picture_link"><%= t('links.report_avatar', %{Report inappropriate picture}) %></a>
    <% end %>
  </div>
<% end %>

<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 %>

<% js_bundle 'legacy/context_roster_user' %>
{'fraction_non_alphanumeric': 0.18974249840391572, 'fraction_numerical': 0.004766971696105554, 'mean_word_length': 3.572985597508758, 'pattern_counts': {'":': 0, '<': 543, '<?xml version=': 0, '>': 592, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5092827', 'n_tokens_mistral': 8239, 'n_tokens_neox': 7513, 'n_words': 1602}