1 <% content_for :head do %>
2 <%= javascript_include_tag "heatmap" %>
4 <% content_for :heading do %>
6 <div class="col-sm-auto">
7 <%= user_image @user %>
10 <h1><%= @user.display_name %> <%= role_icons(@user) %></h1>
11 <% if current_user and @user.id == current_user.id %>
12 <!-- Displaying user's own profile page -->
13 <nav class='secondary-actions'>
16 <%= link_to t(".my edits"), :controller => "changesets", :action => "index", :display_name => current_user.display_name %>
17 <span class='badge count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
20 <%= link_to t(".my notes"), user_notes_path(current_user) %>
21 <span class='badge count-number'><%= number_with_delimiter(current_user.note_comments.size) %></span>
24 <%= link_to t(".my traces"), :controller => "traces", :action => "mine" %>
25 <span class='badge count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
28 <%= link_to t(".my diary"), :controller => "diary_entries", :action => "index", :display_name => current_user.display_name %>
29 <span class='badge count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
32 <%= link_to t(".my comments"), user_diary_comments_path(current_user) %>
33 <span class='badge count-number'><%= number_with_delimiter(current_user.diary_comments.size) %></span>
36 <%= link_to t(".my_account"), account_path %>
39 <% if current_user.blocks.exists? %>
41 <%= link_to t(".blocks on me"), user_received_blocks_path(current_user) %>
42 <span class='badge count-number'><%= number_with_delimiter(current_user.blocks.active.size) %></span>
46 <% if can?(:create, UserBlock) and current_user.blocks_created.exists? %>
48 <%= link_to t(".blocks by me"), user_issued_blocks_path(current_user) %>
49 <span class='badge count-number'><%= number_with_delimiter(current_user.blocks_created.active.size) %></span>
57 <!-- Displaying user profile page to the public -->
58 <nav class='secondary-actions'>
62 <%= link_to t(".edits"), :controller => "changesets", :action => "index", :display_name => @user.display_name %>
63 <span class='badge count-number'><%= number_with_delimiter(@user.changesets.size) %></span>
66 <%= link_to t(".notes"), user_notes_path(@user) %>
67 <span class='badge count-number'><%= number_with_delimiter(@user.note_comments.size) %></span>
70 <%= link_to t(".traces"), :controller => "traces", :action => "index", :display_name => @user.display_name %>
71 <span class='badge count-number'><%= number_with_delimiter(@user.traces.size) %></span>
74 <!-- Displaying another user's profile page -->
77 <%= link_to t(".send message"), new_message_path(@user) %>
80 <%= link_to t(".diary"), :controller => "diary_entries", :action => "index", :display_name => @user.display_name %>
81 <span class='badge count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
84 <%= link_to t(".comments"), user_diary_comments_path(@user) %>
85 <span class='badge count-number'><%= number_with_delimiter(@user.diary_comments.size) %></span>
89 <% if current_user.follows?(@user) %>
90 <%= link_to t(".unfollow"), follow_path(@user), :method => :delete %>
92 <%= link_to t(".follow"), follow_path(@user), :method => :post %>
97 <% if @user.blocks.exists? %>
99 <%= link_to t(".block_history"), user_received_blocks_path(@user) %>
100 <span class='badge count-number'><%= number_with_delimiter(@user.blocks.active.size) %></span>
104 <% if @user.moderator? and @user.blocks_created.exists? %>
106 <%= link_to t(".moderator_history"), user_issued_blocks_path(@user) %>
107 <span class='badge count-number'><%= number_with_delimiter(@user.blocks_created.active.size) %></span>
111 <% if can?(:destroy, UserBlock) and @user.blocks.active.exists? %>
113 <%= link_to t(".revoke_all_blocks"), edit_user_received_blocks_path(@user) %>
117 <% if can?(:create, UserBlock) %>
119 <%= link_to t(".create_block"), new_user_block_path(@user) %>
123 <% if current_user and @user.id != current_user.id %>
125 <%= report_link(t(".report"), @user) %>
129 <% if current_user and UserMute.exists?(owner: current_user, subject: @user) %>
131 <%= link_to t(".destroy_mute"), user_mute_path(@user), :method => :delete %>
133 <% elsif current_user %>
135 <%= link_to t(".create_mute"), user_mute_path(@user), :method => :post, :title => t("user_mutes.index.user_mute_explainer") %>
142 <div class='text-body-secondary'>
144 <dl class="list-inline">
145 <% if @user.home_location_name&.strip.present? %>
146 <dt class="list-inline-item m-0 align-text-bottom">
147 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-geo-alt-fill" viewBox="0 0 16 16">
148 <path d="M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10m0-7a3 3 0 1 1 0-6 3 3 0 0 1 0 6">
149 <title><%= t ".home location" %></title>
153 <dd class="list-inline-item"><%= @user.home_location_name %></dd>
155 <dt class="list-inline-item m-0"><%= t ".mapper since" %></dt>
156 <dd class="list-inline-item"><%= l @user.created_at.to_date, :format => :long %></dd>
157 <dt class="list-inline-item m-0"><%= t ".last map edit" %></dt>
158 <dd class="list-inline-item"><%= l @user.changesets.first&.created_at&.to_date, :format => :long, :default => t(".no activity yet") %></dd>
159 <% unless @user.terms_agreed %>
160 <dt class="list-inline-item m-0"><%= t ".ct status" %></dt>
161 <dd class="list-inline-item">
162 <% if @user.terms_seen? -%>
163 <%= t ".ct declined" %>
165 <%= t ".ct undecided" %>
169 <% if current_user&.moderator? || current_user&.administrator? %>
170 <dt class="list-inline-item m-0"><%= t ".uid" %></dt>
171 <dd class="list-inline-item"><%= link_to @user.id, api_user_path(:id => @user.id) %></dd>
177 <% if can?(:update, :user_status) %>
178 <nav class='secondary-actions'>
180 <% if @user.may_activate? %>
182 <%= link_to t(".activate_user"), user_status_path(@user, :event => "activate"), :method => :put, :data => { :confirm => t(".confirm") } %>
186 <% if @user.may_unsuspend? %>
188 <%= link_to t(".unsuspend_user"), user_status_path(@user, :event => "unsuspend"), :method => :put, :data => { :confirm => t(".confirm") } %>
192 <% if @user.may_confirm? %>
194 <%= link_to t(".confirm_user"), user_status_path(@user, :event => "confirm"), :method => :put, :data => { :confirm => t(".confirm") } %>
198 <% if @user.may_unconfirm? %>
200 <%= link_to t(".unconfirm_user"), user_status_path(@user, :event => "unconfirm"), :method => :put, :data => { :confirm => t(".confirm") } %>
204 <% if @user.may_hide? %>
206 <%= link_to t(".hide_user"), user_status_path(@user, :event => "hide"), :method => :put, :data => { :confirm => t(".confirm") } %>
210 <% if @user.may_unhide? %>
212 <%= link_to t(".unhide_user"), user_status_path(@user, :event => "unhide"), :method => :put, :data => { :confirm => t(".confirm") } %>
216 <% if @user.may_soft_destroy? %>
218 <%= link_to t(".delete_user"), user_status_path(@user, :event => "soft_destroy"), :method => :put, :data => { :confirm => t(".confirm") } %>
225 <% if current_user and current_user.administrator? -%>
226 <div class='text-body-secondary'>
228 <dl class="list-inline">
229 <dt class="list-inline-item m-0"><%= t ".email address" %></dt>
230 <dd class="list-inline-item"><%= @user.email %></dd>
231 <% unless @user.creation_address.nil? -%>
232 <dt class="list-inline-item m-0"><%= t ".created from" %></dt>
233 <dd class="list-inline-item"><%= link_to @user.creation_address, users_list_path(:ip => @user.creation_address) %></dd>
235 <dt class="list-inline-item m-0"><%= t ".status" %></dt>
236 <dd class="list-inline-item"><%= link_to @user.status.capitalize, users_list_path(:status => @user.status) %></dd>
237 <dt class="list-inline-item m-0"><%= t ".spam score" %></dt>
238 <dd class="list-inline-item"><%= @user.spam_score %></dd>
247 <div class="richtext text-break"><%= @user.description.to_html %></div>
249 <% if @heatmap_data[:count].positive? %>
250 <h2 class="text-body-secondary fs-5 mt-4"><%= t("users.show.contributions", :count => @heatmap_data[:count]) %></h2>
251 <%= render :partial => "heatmap", :locals => @heatmap_data %>
254 <%= render :partial => "diary_entries/profile_diaries", :locals => { :diary_entries => @user.diary_entries.visible.order(:created_at => :desc).limit(4) } %>
256 <% if current_user and @user.id == current_user.id %>
258 <%= link_to t(".edit_profile"), edit_profile_path, :class => "btn btn-outline-primary" %>