]> git.openstreetmap.org Git - rails.git/blob - app/views/user/show.html.erb
Merge remote-tracking branch 'upstream/pull/1972'
[rails.git] / app / views / user / show.html.erb
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 to themself -->
8         <ul class='secondary-actions clearfix'>
9           <li>
10             <%= link_to t('.my edits'), :controller => 'changeset', :action => 'list', :display_name => current_user.display_name %>
11             <span class='count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
12           </li>
13           <li>
14             <%= link_to t('.my notes'), :controller => 'notes', :action=> 'mine' %>
15           </li>
16           <li>
17             <%= link_to t('.my traces'), :controller => 'traces', :action => 'mine' %>
18             <span class='count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
19           </li>
20           <li>
21             <%= link_to t('.my diary'), :controller => 'diary_entry', :action => 'list', :display_name => current_user.display_name %>
22             <span class='count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
23           </li>
24           <li>
25             <%= link_to t('.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => current_user.display_name %>
26           </li>
27           <li>
28             <%= link_to t('.my settings'), :controller => 'user', :action => 'account', :display_name => current_user.display_name %>
29           </li>
30
31           <% if current_user.blocks.exists? %>
32             <li>
33               <%= link_to t('.blocks on me'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => current_user.display_name %>
34               <span class='count-number'><%= number_with_delimiter(current_user.blocks.active.size) %></span>
35             </li>
36           <% end %>
37
38           <% if current_user and current_user.moderator? and current_user.blocks_created.exists? %>
39             <li>
40               <%= link_to t('.blocks by me'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => current_user.display_name %>
41               <span class='count-number'><%= number_with_delimiter(current_user.blocks_created.active.size) %></span>
42             </li>
43           <% end %>
44
45         </ul>
46
47         <% else %>
48         <!-- Displaying user profile page to the public -->
49         <ul class='secondary-actions clearfix'>
50
51           <li>
52             <%= link_to t('.edits'), :controller => 'changeset', :action => 'list', :display_name => @user.display_name %>
53             <span class='count-number'><%= number_with_delimiter(@user.changesets.size) %></span>
54           </li>
55           <li>
56             <%= link_to t('.notes'), :controller => 'notes', :action=> 'mine' %>
57           </li>
58           <li>
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>
61           </li>
62
63           <!-- Displaying another user's profile page -->
64
65           <li>
66             <%= link_to t('.send message'), new_message_path(@user) %>
67           </li>
68           <li>
69             <%= link_to t('.diary'), :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %>
70             <span class='count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
71           </li>
72           <li>
73             <%= link_to t('.comments'), :controller => 'diary_entry', :action => 'comments', :display_name => @user.display_name %>
74           </li>
75           <li>
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 %>
80             <% else %>
81               <%= link_to t('.add as friend'), make_friend_path(:display_name => @user.display_name) %>
82             <% end %>
83           </li>
84
85           <% if @user.blocks.exists? %>
86             <li>
87               <%= link_to t('.block_history'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @user.display_name %>
88               <span class='count-number'><%= number_with_delimiter(@user.blocks.active.size) %></span>
89             </li>
90           <% end %>
91
92           <% if @user.moderator? and @user.blocks_created.exists? %>
93             <li>
94               <%= link_to t('.moderator_history'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => @user.display_name %>
95               <span class='count-number'><%= number_with_delimiter(@user.blocks_created.active.size) %></span>
96             </li>
97           <% end %>
98
99           <% if current_user and current_user.moderator? %>
100             <li>
101             <%= link_to t('.create_block'), :controller => 'user_blocks', :action => 'new', :display_name => @user.display_name %>
102             </li>
103           <% end %>
104
105           <% if current_user and @user.id != current_user.id %>
106             <li>
107               <%= report_link(t(".report"), @user) %>
108             </li>
109           <% end %>
110         </ul>
111
112       <% end %>
113
114       <% if current_user and current_user.administrator? %>
115
116         <ul class='secondary-actions clearfix'>
117           <% if ["active", "confirmed"].include? @user.status %>
118             <li>
119               <%= link_to t('.deactivate_user'), set_status_user_path(:status => 'pending', :display_name => @user.display_name), :data => { :confirm => t('.confirm') } %>
120             </li>
121           <% elsif ["pending"].include? @user.status %>
122             <li>
123               <%= link_to t('.activate_user'), set_status_user_path(:status => 'active', :display_name => @user.display_name), :data => { :confirm => t('.confirm') } %>
124             </li>
125           <% end %>
126
127           <% if ["active", "suspended"].include? @user.status %>
128             <li>
129               <%= link_to t('.confirm_user'), set_status_user_path(:status => 'confirmed', :display_name => @user.display_name), :data => { :confirm => t('.confirm') } %>
130             </li>
131           <% end %>
132             <li>
133               <% if ["pending", "active", "confirmed", "suspended"].include? @user.status %>
134                 <%= link_to t('.hide_user'), set_status_user_path(:status => 'deleted', :display_name => @user.display_name), :data => { :confirm => t('.confirm') } %>
135             <% else %>
136               <%= link_to t('.unhide_user'), set_status_user_path(:status => 'active', :display_name => @user.display_name), :data => { :confirm => t('.confirm') } %>
137             </li>
138           <% end %>
139           <li>
140             <%= link_to t('.delete_user'), delete_user_path(:display_name => @user.display_name), :data => { :confirm => t('.confirm') } %>
141           </li>
142         </ul>
143
144         <% end %>
145
146       <p class='deemphasize'>
147         <small>
148           <%= t '.mapper since' %> <%= l @user.creation_time.to_date, :format => :long %>
149           <% unless @user.terms_agreed %>
150             |
151             <%= t '.ct status' %>
152             <% if @user.terms_seen? -%>
153               <%= t '.ct declined' %>
154             <% else -%>
155               <%= t '.ct undecided' %>
156             <% end -%>
157           <% end -%>
158         </small>
159       </p>
160     </div>
161
162     <div class="user-description richtext"><%= @user.description.to_html %></div>
163
164   </div>
165
166   <% if current_user and current_user.administrator? -%>
167     <div class='admin-user-info deemphasize'>
168       <small><b><%= t '.email address' %></b> <%= @user.email %></small>
169       <% unless @user.creation_ip.nil? -%>
170         <small><b><%= t '.created from' %></b> <%= @user.creation_ip %></small>
171       <% end -%>
172       <small><b><%= t '.status' %></b> <%= @user.status.capitalize %></small>
173       <small><b><%= t '.spam score' %></b> <%= @user.spam_score %></small>
174     </div>
175   <% end -%>
176
177 <% end %>
178
179   <% if current_user and @user.id == current_user.id %>
180     <% if @user.home_lat.nil? or @user.home_lon.nil? %>
181       <div id="map" class="content_map">
182         <p id="no_home_location"><%= raw(t '.if set location', :settings_link => (link_to t('.settings_link_text'), :controller => 'user', :action => 'account', :display_name => current_user.display_name)) %></p>
183       </div>
184     <% else %>
185       <% content_for :head do %>
186         <%= javascript_include_tag "user" %>
187       <% end %>
188       <%
189         user_data = {
190           :lon => current_user.home_lon,
191           :lat => current_user.home_lat,
192           :icon => image_path("marker-red.png"),
193           :description => render(:partial => "popup", :object => current_user, :locals => {:type => "your location"})
194         }
195       %>
196       <%= content_tag "div", "", :id => "map", :class => "content_map", :data => {:user => user_data} %>
197     <% end %>
198
199     <% friends = @user.friends.collect { |f| f.befriendee } %>
200     <% nearby = @user.nearby - friends %>
201
202   <div class="activity-block column-1">
203     <h3><%= t '.my friends' %></h3>
204
205     <% if friends.empty? %>
206       <%= t '.no friends' %>
207     <% else %>
208       <ul class='secondary-actions clearfix'>
209         <li><%= link_to t('.friends_changesets'), friend_changesets_path %></li>
210         <li><%= link_to t('.friends_diaries'), friend_diaries_path %></li>
211       </ul>
212       <div id="friends-container">
213         <%= render :partial => "contact", :collection => friends, :locals => {:type => "friend"} %>
214       </div>
215     <% end %>
216   </div>
217
218   <div class="activity-block column-1">
219     <h3><%= t '.nearby users' %></h3>
220
221     <% if nearby.empty? %>
222       <%= t '.no nearby users' %>
223     <% else %>
224       <ul class='secondary-actions clearfix'>
225         <li><%= link_to t('.nearby_changesets'), nearby_changesets_path %></li>
226         <li><%= link_to t('.nearby_diaries'), nearby_diaries_path %></li>
227       </ul>
228       <div id="nearbyusers">
229         <%= render :partial => "contact", :collection => nearby, :locals => {:type => "nearby mapper"} %>
230       </div>
231     <% end %>
232   </div>
233 <% end %>