1 <% content_for :heading do %>
2 <div id='userinformation'>
3 <%= user_image @user %>
4 <div class='userinformation-inner'>
5 <h1><%= @user.display_name %> <%= role_icons(@user) %></h1>
6 <% if current_user and @user.id == current_user.id %>
7 <!-- Displaying user's own profile page -->
8 <ul class='secondary-actions clearfix'>
10 <%= link_to t(".my edits"), :controller => "changesets", :action => "index", :display_name => current_user.display_name %>
11 <span class='count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
14 <%= link_to t(".my notes"), user_notes_path(@user) %>
17 <%= link_to t(".my traces"), :controller => "traces", :action => "mine" %>
18 <span class='count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
21 <%= link_to t(".my diary"), :controller => "diary_entries", :action => "index", :display_name => current_user.display_name %>
22 <span class='count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
25 <%= link_to t(".my comments"), :controller => "diary_entries", :action => "comments", :display_name => current_user.display_name %>
28 <%= link_to t(".my settings"), user_account_path(current_user) %>
31 <% if current_user.blocks.exists? %>
33 <%= link_to t(".blocks on me"), user_blocks_on_path(current_user) %>
34 <span class='count-number'><%= number_with_delimiter(current_user.blocks.active.size) %></span>
38 <% if can?(:create, UserBlock) and current_user.blocks_created.exists? %>
40 <%= link_to t(".blocks by me"), user_blocks_by_path(current_user) %>
41 <span class='count-number'><%= number_with_delimiter(current_user.blocks_created.active.size) %></span>
48 <!-- Displaying user profile page to the public -->
49 <ul class='secondary-actions clearfix'>
52 <%= link_to t(".edits"), :controller => "changesets", :action => "index", :display_name => @user.display_name %>
53 <span class='count-number'><%= number_with_delimiter(@user.changesets.size) %></span>
56 <%= link_to t(".notes"), user_notes_path(@user) %>
59 <%= link_to t(".traces"), :controller => "traces", :action => "index", :display_name => @user.display_name %>
60 <span class='count-number'><%= number_with_delimiter(@user.traces.size) %></span>
63 <!-- Displaying another user's profile page -->
66 <%= link_to t(".send message"), new_message_path(@user) %>
69 <%= link_to t(".diary"), :controller => "diary_entries", :action => "index", :display_name => @user.display_name %>
70 <span class='count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
73 <%= link_to t(".comments"), :controller => "diary_entries", :action => "comments", :display_name => @user.display_name %>
76 <% if current_user and current_user.is_friends_with?(@user) %>
77 <%= link_to t(".remove as friend"), remove_friend_path(:display_name => @user.display_name), :method => :post %>
78 <% elsif current_user %>
79 <%= link_to t(".add as friend"), make_friend_path(:display_name => @user.display_name), :method => :post %>
81 <%= link_to t(".add as friend"), make_friend_path(:display_name => @user.display_name) %>
85 <% if @user.blocks.exists? %>
87 <%= link_to t(".block_history"), user_blocks_on_path(@user) %>
88 <span class='count-number'><%= number_with_delimiter(@user.blocks.active.size) %></span>
92 <% if @user.moderator? and @user.blocks_created.exists? %>
94 <%= link_to t(".moderator_history"), user_blocks_by_path(@user) %>
95 <span class='count-number'><%= number_with_delimiter(@user.blocks_created.active.size) %></span>
99 <% if can?(:create, UserBlock) %>
101 <%= link_to t(".create_block"), new_user_block_path(@user) %>
105 <% if current_user and @user.id != current_user.id %>
107 <%= report_link(t(".report"), @user) %>
114 <% if can?(:set_status, User) || can?(:destroy, User) %>
116 <ul class='secondary-actions clearfix'>
117 <% if can? :set_status, User %>
118 <% if ["active", "confirmed"].include? @user.status %>
120 <%= link_to t(".deactivate_user"), set_status_user_path(:status => "pending", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
122 <% elsif ["pending"].include? @user.status %>
124 <%= link_to t(".activate_user"), set_status_user_path(:status => "active", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
128 <% if ["active", "suspended"].include? @user.status %>
130 <%= link_to t(".confirm_user"), set_status_user_path(:status => "confirmed", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
134 <% if ["pending", "active", "confirmed", "suspended"].include? @user.status %>
135 <%= link_to t(".hide_user"), set_status_user_path(:status => "deleted", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
137 <%= link_to t(".unhide_user"), set_status_user_path(:status => "active", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
141 <% if can? :destroy, User %>
143 <%= link_to t(".delete_user"), user_path(:display_name => @user.display_name), :method => :delete, :data => { :confirm => t(".confirm") } %>
150 <p class='text-muted'>
152 <%= t ".mapper since" %> <%= l @user.creation_time.to_date, :format => :long %>
153 <% unless @user.terms_agreed %>
155 <%= t ".ct status" %>
156 <% if @user.terms_seen? -%>
157 <%= t ".ct declined" %>
159 <%= t ".ct undecided" %>
166 <div class="user-description richtext text-break"><%= @user.description.to_html %></div>
168 <% if current_user and @user.id == current_user.id %>
170 <%= link_to t(".edit_profile"), edit_profile_path, :class => "btn btn-outline-primary" %>
176 <% if current_user and current_user.administrator? -%>
177 <div class='admin-user-info text-muted'>
178 <small><b><%= t ".email address" %></b> <%= @user.email %></small>
179 <% unless @user.creation_ip.nil? -%>
180 <small><b><%= t ".created from" %></b> <%= @user.creation_ip %></small>
182 <small><b><%= t ".status" %></b> <%= @user.status.capitalize %></small>
183 <small><b><%= t ".spam score" %></b> <%= @user.spam_score %></small>
190 <% if current_user and @user.id == current_user.id %>
191 <div class="col-md order-md-last">
192 <% if @user.home_lat.nil? or @user.home_lon.nil? %>
193 <div id="map" class="content_map">
194 <p id="no_home_location"><%= t(".set_location_html", :edit_profile_url => edit_profile_path) %></p>
197 <% content_for :head do %>
198 <%= javascript_include_tag "user" %>
201 :lon => current_user.home_lon,
202 :lat => current_user.home_lat,
203 :icon => image_path("marker-red.png"),
204 :description => render(:partial => "popup", :object => current_user, :locals => { :type => "your location" })
206 <%= tag.div "", :id => "map", :class => "content_map", :data => { :user => user_data } %>
209 <% friends = @user.friends %>
210 <% nearby = @user.nearby - friends %>
214 <h3><%= t ".my friends" %></h3>
216 <% if friends.empty? %>
217 <%= t ".no friends" %>
219 <ul class='secondary-actions clearfix'>
220 <li><%= link_to t(".friends_changesets"), friend_changesets_path %></li>
221 <li><%= link_to t(".friends_diaries"), friends_diary_entries_path %></li>
223 <div id="friends-container">
224 <%= render :partial => "contact", :collection => friends, :locals => { :type => "friend" } %>
230 <h3><%= t ".nearby users" %></h3>
232 <% if nearby.empty? %>
233 <%= t ".no nearby users" %>
235 <ul class='secondary-actions clearfix'>
236 <li><%= link_to t(".nearby_changesets"), nearby_changesets_path %></li>
237 <li><%= link_to t(".nearby_diaries"), nearby_diary_entries_path %></li>
239 <div id="nearbyusers">
240 <%= render :partial => "contact", :collection => nearby, :locals => { :type => "nearby mapper" } %>