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