1 <% owned = current_user && @user == current_user %>
3 <% content_for :head do %>
4 <%= javascript_include_tag "heatmap" %>
6 <% content_for :heading do %>
8 <div class="col-sm-auto">
9 <% if current_user and @user == current_user %>
10 <%= link_to user_image(@user), profile_image_path, :class => "d-block", :title => t(".change_image") %>
12 <%= user_image @user %>
17 <%= @user.display_name %>
18 <%= render "role_icons" %>
20 <% if current_user and @user.id == current_user.id %>
21 <!-- Displaying user's own profile page -->
22 <nav class='secondary-actions'>
25 <%= link_to t(".my edits"), :controller => "changesets", :action => "index", :display_name => current_user.display_name %>
26 <span class='badge count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
29 <%= link_to t(".my notes"), user_notes_path(current_user) %>
30 <span class='badge count-number'><%= number_with_delimiter(current_user.note_comments.size) %></span>
33 <%= link_to t(".my traces"), :controller => "traces", :action => "mine" %>
34 <span class='badge count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
37 <%= link_to t(".my diary"), :controller => "diary_entries", :action => "index", :display_name => current_user.display_name %>
38 <span class='badge count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
41 <%= link_to t(".my comments"), user_diary_comments_path(current_user) %>
42 <span class='badge count-number'><%= number_with_delimiter(current_user.diary_comments.size) %></span>
45 <%= link_to t(".my_account"), account_path %>
48 <% if current_user.blocks.exists? %>
50 <%= link_to t(".blocks on me"), user_received_blocks_path(current_user) %>
51 <span class='badge count-number'><%= number_with_delimiter(current_user.blocks.active.size) %></span>
55 <% if can?(:create, UserBlock) and current_user.blocks_created.exists? %>
57 <%= link_to t(".blocks by me"), user_issued_blocks_path(current_user) %>
58 <span class='badge count-number'><%= number_with_delimiter(current_user.blocks_created.active.size) %></span>
66 <!-- Displaying user profile page to the public -->
67 <nav class='secondary-actions'>
71 <%= link_to t(".edits"), :controller => "changesets", :action => "index", :display_name => @user.display_name %>
72 <span class='badge count-number'><%= number_with_delimiter(@user.changesets.size) %></span>
75 <%= link_to t(".notes"), user_notes_path(@user) %>
76 <span class='badge count-number'><%= number_with_delimiter(@user.note_comments.size) %></span>
79 <%= link_to t(".traces"), :controller => "traces", :action => "index", :display_name => @user.display_name %>
80 <span class='badge count-number'><%= number_with_delimiter(@user.traces.size) %></span>
83 <!-- Displaying another user's profile page -->
86 <%= link_to t(".send message"), new_message_path(@user) %>
89 <%= link_to t(".diary"), :controller => "diary_entries", :action => "index", :display_name => @user.display_name %>
90 <span class='badge count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
93 <%= link_to t(".comments"), user_diary_comments_path(@user) %>
94 <span class='badge count-number'><%= number_with_delimiter(@user.diary_comments.size) %></span>
98 <% if current_user.follows?(@user) %>
99 <%= link_to t(".unfollow"), follow_path(@user), :method => :delete %>
101 <%= link_to t(".follow"), follow_path(@user), :method => :post %>
106 <% if @user.blocks.exists? %>
108 <%= link_to t(".block_history"), user_received_blocks_path(@user) %>
109 <span class='badge count-number'><%= number_with_delimiter(@user.blocks.active.size) %></span>
113 <% if @user.moderator? and @user.blocks_created.exists? %>
115 <%= link_to t(".moderator_history"), user_issued_blocks_path(@user) %>
116 <span class='badge count-number'><%= number_with_delimiter(@user.blocks_created.active.size) %></span>
120 <% if can?(:destroy, UserBlock) and @user.blocks.active.exists? %>
122 <%= link_to t(".revoke_all_blocks"), edit_user_received_blocks_path(@user) %>
126 <% if can?(:create, UserBlock) %>
128 <%= link_to t(".create_block"), new_user_block_path(@user) %>
132 <% if current_user and @user.id != current_user.id %>
134 <%= report_link(t(".report"), @user) %>
138 <% if current_user and UserMute.exists?(owner: current_user, subject: @user) %>
140 <%= link_to t(".destroy_mute"), user_mute_path(@user), :method => :delete %>
142 <% elsif current_user %>
144 <%= link_to t(".create_mute"), user_mute_path(@user), :method => :post, :title => t("user_mutes.index.user_mute_explainer") %>
151 <div class='text-body-secondary'>
153 <dl class="list-inline">
154 <dt class="list-inline-item m-0"><%= t ".mapper since" %></dt>
155 <dd class="list-inline-item"><%= l @user.created_at.to_date, :format => :long %></dd>
156 <dt class="list-inline-item m-0"><%= t ".last map edit" %></dt>
157 <dd class="list-inline-item"><%= l @user.changesets.first&.created_at&.to_date, :format => :long, :default => t(".no activity yet") %></dd>
158 <% unless @user.terms_agreed %>
159 <dt class="list-inline-item m-0"><%= t ".ct status" %></dt>
160 <dd class="list-inline-item">
161 <% if @user.terms_seen? -%>
162 <%= t ".ct declined" %>
164 <%= t ".ct undecided" %>
168 <% if current_user&.moderator? || current_user&.administrator? %>
169 <dt class="list-inline-item m-0"><%= t ".uid" %></dt>
170 <dd class="list-inline-item"><%= link_to @user.id, api_user_path(:id => @user.id) %></dd>
176 <% if can?(:update, :user_status) %>
177 <nav class='secondary-actions'>
179 <% if @user.may_activate? %>
181 <%= link_to t(".activate_user"), user_status_path(@user, :event => "activate"), :method => :put, :data => { :confirm => t(".confirm") } %>
185 <% if @user.may_suspend? %>
187 <%= link_to t(".suspend_user"), user_status_path(@user, :event => "suspend"), :method => :put, :data => { :confirm => t(".confirm") } %>
191 <% if @user.may_unsuspend? %>
193 <%= link_to t(".unsuspend_user"), user_status_path(@user, :event => "unsuspend"), :method => :put, :data => { :confirm => t(".confirm") } %>
197 <% if @user.may_confirm? %>
199 <%= link_to t(".confirm_user"), user_status_path(@user, :event => "confirm"), :method => :put, :data => { :confirm => t(".confirm") } %>
203 <% if @user.may_unconfirm? %>
205 <%= link_to t(".unconfirm_user"), user_status_path(@user, :event => "unconfirm"), :method => :put, :data => { :confirm => t(".confirm") } %>
209 <% if @user.may_undelete? %>
211 <%= link_to t(".undelete_user"), user_status_path(@user, :event => "undelete"), :method => :put, :data => { :confirm => t(".confirm") } %>
218 <% if current_user and current_user.administrator? -%>
219 <div class='text-body-secondary'>
221 <dl class="list-inline">
222 <dt class="list-inline-item m-0"><%= t ".email address" %></dt>
223 <dd class="list-inline-item"><%= @user.email %></dd>
224 <% unless @user.creation_address.nil? -%>
225 <dt class="list-inline-item m-0"><%= t ".created from" %></dt>
226 <dd class="list-inline-item"><%= link_to @user.creation_address, users_list_path(:ip => @user.creation_address) %></dd>
228 <dt class="list-inline-item m-0"><%= t ".status" %></dt>
229 <dd class="list-inline-item"><%= link_to @user.status.capitalize, users_list_path(:status => @user.status) %></dd>
230 <dt class="list-inline-item m-0"><%= t ".spam score" %></dt>
231 <dd class="list-inline-item"><%= @user.spam_score %></dd>
240 <% if @user.home_location_name&.strip.present? || @user.company&.strip.present? || !@user.social_links.empty? || owned %>
242 <div class="col-sm-3">
243 <%= render "sidebar_section", :edit_title => t(".change_image"),
244 :edit_path => profile_image_path do %>
247 <%= render "sidebar_section", :present => @user.home_location_name&.strip.present?,
248 :edit_title => t(".edit_location"),
249 :edit_path => profile_location_path do %>
250 <div class="icon-link mw-100">
251 <i class="align-self-baseline bi bi-geo-alt-fill flex-shrink-0 fs-6" aria-hidden="true"></i>
252 <span class="visually-hidden"><%= t ".home_location" %></span>
253 <span class="text-truncate">
254 <%= @user.home_location_name %>
259 <%= render "sidebar_section", :present => @user.company&.strip.present?,
260 :edit_title => t(".edit_company"),
261 :edit_path => profile_company_path do %>
262 <div class="icon-link mw-100">
263 <i class="align-self-baseline bi bi-buildings-fill flex-shrink-0 fs-6" aria-hidden="true"></i>
264 <span class="visually-hidden"><%= t ".company" %></span>
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>
288 <div class="mt-2 mb-3 col-sm-4">
289 <%= link_to t(".edit_description"), profile_description_path, :class => "btn btn-sm w-100 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 }, :class => "heatmap_frame" %>
302 <%= bootstrap_form_for current_user, :url => profile_heatmap_path, :layout => :inline do |f| %>
303 <%= f.check_box :public_heatmap, :label => "Show the heatmap on your profile page", :checked => current_user.public_heatmap? %>
304 <%= f.primary "Save" %>
308 <%= render :partial => "diary_entries/profile_diaries", :locals => { :diary_entries => @user.diary_entries.visible.order(:created_at => :desc).limit(4) } %>