1 <% content_for :head do %>
2 <%= javascript_include_tag "heatmap" %>
4 <% content_for :heading do %>
6 <div class="col-sm-auto">
7 <% if current_user and @user == current_user %>
8 <%= link_to user_image(@user), profile_image_path, :class => "d-block", :title => t(".change_image") %>
10 <%= user_image @user %>
14 <h1><%= @user.display_name %> <%= role_icons(@user) %></h1>
15 <% if current_user and @user.id == current_user.id %>
16 <!-- Displaying user's own profile page -->
17 <nav class='secondary-actions'>
20 <%= link_to t(".my edits"), :controller => "changesets", :action => "index", :display_name => current_user.display_name %>
21 <span class='badge count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
24 <%= link_to t(".my notes"), user_notes_path(current_user) %>
25 <span class='badge count-number'><%= number_with_delimiter(current_user.note_comments.size) %></span>
28 <%= link_to t(".my traces"), :controller => "traces", :action => "mine" %>
29 <span class='badge count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
32 <%= link_to t(".my diary"), :controller => "diary_entries", :action => "index", :display_name => current_user.display_name %>
33 <span class='badge count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
36 <%= link_to t(".my comments"), user_diary_comments_path(current_user) %>
37 <span class='badge count-number'><%= number_with_delimiter(current_user.diary_comments.size) %></span>
40 <%= link_to t(".my_account"), account_path %>
43 <% if current_user.blocks.exists? %>
45 <%= link_to t(".blocks on me"), user_received_blocks_path(current_user) %>
46 <span class='badge count-number'><%= number_with_delimiter(current_user.blocks.active.size) %></span>
50 <% if can?(:create, UserBlock) and current_user.blocks_created.exists? %>
52 <%= link_to t(".blocks by me"), user_issued_blocks_path(current_user) %>
53 <span class='badge count-number'><%= number_with_delimiter(current_user.blocks_created.active.size) %></span>
61 <!-- Displaying user profile page to the public -->
62 <nav class='secondary-actions'>
66 <%= link_to t(".edits"), :controller => "changesets", :action => "index", :display_name => @user.display_name %>
67 <span class='badge count-number'><%= number_with_delimiter(@user.changesets.size) %></span>
70 <%= link_to t(".notes"), user_notes_path(@user) %>
71 <span class='badge count-number'><%= number_with_delimiter(@user.note_comments.size) %></span>
74 <%= link_to t(".traces"), :controller => "traces", :action => "index", :display_name => @user.display_name %>
75 <span class='badge count-number'><%= number_with_delimiter(@user.traces.size) %></span>
78 <!-- Displaying another user's profile page -->
81 <%= link_to t(".send message"), new_message_path(@user) %>
84 <%= link_to t(".diary"), :controller => "diary_entries", :action => "index", :display_name => @user.display_name %>
85 <span class='badge count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
88 <%= link_to t(".comments"), user_diary_comments_path(@user) %>
89 <span class='badge count-number'><%= number_with_delimiter(@user.diary_comments.size) %></span>
93 <% if current_user.follows?(@user) %>
94 <%= link_to t(".unfollow"), follow_path(@user), :method => :delete %>
96 <%= link_to t(".follow"), follow_path(@user), :method => :post %>
101 <% if @user.blocks.exists? %>
103 <%= link_to t(".block_history"), user_received_blocks_path(@user) %>
104 <span class='badge count-number'><%= number_with_delimiter(@user.blocks.active.size) %></span>
108 <% if @user.moderator? and @user.blocks_created.exists? %>
110 <%= link_to t(".moderator_history"), user_issued_blocks_path(@user) %>
111 <span class='badge count-number'><%= number_with_delimiter(@user.blocks_created.active.size) %></span>
115 <% if can?(:destroy, UserBlock) and @user.blocks.active.exists? %>
117 <%= link_to t(".revoke_all_blocks"), edit_user_received_blocks_path(@user) %>
121 <% if can?(:create, UserBlock) %>
123 <%= link_to t(".create_block"), new_user_block_path(@user) %>
127 <% if current_user and @user.id != current_user.id %>
129 <%= report_link(t(".report"), @user) %>
133 <% if current_user and UserMute.exists?(owner: current_user, subject: @user) %>
135 <%= link_to t(".destroy_mute"), user_mute_path(@user), :method => :delete %>
137 <% elsif current_user %>
139 <%= link_to t(".create_mute"), user_mute_path(@user), :method => :post, :title => t("user_mutes.index.user_mute_explainer") %>
146 <div class='text-body-secondary'>
148 <dl class="list-inline">
149 <dt class="list-inline-item m-0"><%= t ".mapper since" %></dt>
150 <dd class="list-inline-item"><%= l @user.created_at.to_date, :format => :long %></dd>
151 <dt class="list-inline-item m-0"><%= t ".last map edit" %></dt>
152 <dd class="list-inline-item"><%= l @user.changesets.first&.created_at&.to_date, :format => :long, :default => t(".no activity yet") %></dd>
153 <% unless @user.terms_agreed %>
154 <dt class="list-inline-item m-0"><%= t ".ct status" %></dt>
155 <dd class="list-inline-item">
156 <% if @user.terms_seen? -%>
157 <%= t ".ct declined" %>
159 <%= t ".ct undecided" %>
163 <% if current_user&.moderator? || current_user&.administrator? %>
164 <dt class="list-inline-item m-0"><%= t ".uid" %></dt>
165 <dd class="list-inline-item"><%= link_to @user.id, api_user_path(:id => @user.id) %></dd>
171 <% if can?(:update, :user_status) %>
172 <nav class='secondary-actions'>
174 <% if @user.may_activate? %>
176 <%= link_to t(".activate_user"), user_status_path(@user, :event => "activate"), :method => :put, :data => { :confirm => t(".confirm") } %>
180 <% if @user.may_unsuspend? %>
182 <%= link_to t(".unsuspend_user"), user_status_path(@user, :event => "unsuspend"), :method => :put, :data => { :confirm => t(".confirm") } %>
186 <% if @user.may_confirm? %>
188 <%= link_to t(".confirm_user"), user_status_path(@user, :event => "confirm"), :method => :put, :data => { :confirm => t(".confirm") } %>
192 <% if @user.may_unconfirm? %>
194 <%= link_to t(".unconfirm_user"), user_status_path(@user, :event => "unconfirm"), :method => :put, :data => { :confirm => t(".confirm") } %>
198 <% if @user.may_hide? %>
200 <%= link_to t(".hide_user"), user_status_path(@user, :event => "hide"), :method => :put, :data => { :confirm => t(".confirm") } %>
204 <% if @user.may_unhide? %>
206 <%= link_to t(".unhide_user"), user_status_path(@user, :event => "unhide"), :method => :put, :data => { :confirm => t(".confirm") } %>
210 <% if @user.may_soft_destroy? %>
212 <%= link_to t(".delete_user"), user_status_path(@user, :event => "soft_destroy"), :method => :put, :data => { :confirm => t(".confirm") } %>
219 <% if current_user and current_user.administrator? -%>
220 <div class='text-body-secondary'>
222 <dl class="list-inline">
223 <dt class="list-inline-item m-0"><%= t ".email address" %></dt>
224 <dd class="list-inline-item"><%= @user.email %></dd>
225 <% unless @user.creation_address.nil? -%>
226 <dt class="list-inline-item m-0"><%= t ".created from" %></dt>
227 <dd class="list-inline-item"><%= link_to @user.creation_address, users_list_path(:ip => @user.creation_address) %></dd>
229 <dt class="list-inline-item m-0"><%= t ".status" %></dt>
230 <dd class="list-inline-item"><%= link_to @user.status.capitalize, users_list_path(:status => @user.status) %></dd>
231 <dt class="list-inline-item m-0"><%= t ".spam score" %></dt>
232 <dd class="list-inline-item"><%= @user.spam_score %></dd>
241 <% owned = current_user && @user == current_user %>
242 <% if @user.home_location_name&.strip.present? || @user.company&.strip.present? || !@user.social_links.empty? || owned %>
244 <div class="col-sm-3">
245 <%= render "sidebar_section", :edit_title => t(".change_image"),
246 :edit_path => profile_image_path do %>
249 <%= render "sidebar_section", :present => @user.home_location_name&.strip.present?,
250 :edit_title => t(".edit_location"),
251 :edit_path => profile_location_path do %>
252 <div class="icon-link mw-100">
253 <%= inline_svg_tag "icons/home_location.svg", :class => "flex-shrink-0", :title => t(".home_location") %>
254 <span class="text-truncate">
255 <%= @user.home_location_name %>
260 <%= render "sidebar_section", :present => @user.company&.strip.present?,
261 :edit_title => t(".edit_company"),
262 :edit_path => profile_company_path do %>
263 <div class="icon-link mw-100">
264 <%= inline_svg_tag "icons/company.svg", :class => "flex-shrink-0", :title => t(".company") %>
265 <%= tag.span :class => "text-truncate", :title => t(".company_tooltip") do %>
271 <%= render "sidebar_section", :present => !@user.social_links.empty?,
272 :edit_title => t(".edit_links"),
273 :edit_path => profile_links_path do %>
274 <%= render "social_links/show", :social_links => @user.social_links %>
279 <%= tag.button t(".edit_profile_details"), :type => "button",
280 :class => "btn btn-sm btn-outline-primary w-100 overflow-hidden",
281 :data => { :bs_toggle => "collapse", :bs_target => "[data-sidebar-edit]" } %>
285 <div class="col-sm-9">
286 <div class="richtext text-break"><%= @user.description.to_html %></div>
289 <%= link_to t(".edit_description"), profile_description_path, :class => "btn btn-outline-primary" %>
295 <div class="richtext text-break"><%= @user.description.to_html %></div>
298 <% if @heatmap_frame %>
299 <%= turbo_frame_tag "#{dom_id(@user)}_heatmap", :src => user_heatmap_path(@user), :data => { :turbo => false } %>
302 <%= render :partial => "diary_entries/profile_diaries", :locals => { :diary_entries => @user.diary_entries.visible.order(:created_at => :desc).limit(4) } %>