%
# Copyright (C) 2012 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see .
%>
<%
css_bundle :profile_show, :tinymce
js_bundle :profile_show
add_body_class 'not-editing'
js_env PROFILE: @user_data if @user_data[:can_edit]
js_env(folder_id: @user.profile_pics_folder.id) if @user == @current_user
%>
<%= form_tag update_profile_profile_path, { :method => :put, :id => :edit_profile_form, :class => "ic-Form-control" } do %>
<% if @user_data[:can_edit_avatar] %>
<%= avatar(@user_data[:id], size: 128, url: '#', edit: true, class: "profile-link",
title: t('titles.click_to_change_profile_pic', "Click to change profile pic"),
sr_content: t('Click to change profile picture for %{display_name}', :display_name => @user.short_name)) %>
<% elsif @user != @current_user %>
<%= avatar(@user, size: 128, url: report_avatar_image_url(@user.id),
class: "report_avatar_link", show_flag: true,
title: t("Click to report profile picture"),
sr_content: t('Click to report profile picture for %{display_name}', :display_name => @user.short_name)) %>
<% else %>
<%= avatar(@user_data[:id], size: 128, url: nil) %>
<% end %>
<% if @user_data[:can_edit_name] %>
<%= @user_data[:short_name] %> <% if @user_data[:pronouns] %>(<%= @user_data[:pronouns] %>)<% end %>
<%# even if @domain_root_account.settings[:can_add_pronouns] is false, we still want to let someone that has pronouns set to see this so they can unset them %>
<% if @user.pronouns || @domain_root_account.settings[:can_add_pronouns] %>
<%= select_tag :pronouns,
options_for_select(([[t("None"), '']] + @domain_root_account.pronouns + [@user.pronouns]).compact.uniq, @user.pronouns),
class:"show-if-editing",
disabled:!@domain_root_account.can_change_pronouns?
%>
<% end %>
<%= @user_data[:title] %>
<% else %>
<%= @user_data[:short_name] %> <% if @user_data[:pronouns] %>(<%= @user_data[:pronouns] %>)<% end %>
<%= t(:social_instructions, "Check the contact methods you'd like to be visible to others on your profile.") %>
<%= link_to(t(:manage_settings, "Manage Registered Services"), settings_profile_path) %>
<% else %>
<%= t('#profile.you_have_no_services', "No registered services, you can add some on the *settings* page.", :name => @user_data[:short_name], :wrapper => link_to('\1', settings_profile_path)) %>
<% end %>
<%= t :ways_to_contact_user, "Contact" %>
<% if @user_data[:user_services].blank? && @user == @current_user %>
<%= t('#profile.you_have_no_services', "No registered services, you can add some on the *settings* page.", :name => @user_data[:short_name], :wrapper => link_to('\1', settings_profile_path)) %>
<% else %>
<% if current_user_is_account_admin && @user != @current_user %>