]> git.openstreetmap.org Git - rails.git/blob - app/views/user/view.html.erb
Improve user page navigation menu
[rails.git] / app / views / user / view.html.erb
1 <%= user_image @this_user %>
2
3 <h2><%= @this_user.display_name %><%= role_icons(@this_user) %></h2>
4
5 <div id="userinformation">
6   <% if @user and @this_user.id == @user.id %>
7     <!-- Displaying user's own profile page -->
8     <%= link_to t('user.view.my edits'), :controller => 'changeset', :action => 'list', :display_name => @user.display_name %>
9     <span class='count-number'><%= number_with_delimiter(@this_user.changesets.size) %></span>
10     |
11     <%= link_to t('user.view.my traces'), :controller => 'trace', :action=>'mine' %>
12     <span class='count-number'><%= number_with_delimiter(@this_user.traces.size) %></span>
13     |
14     <%= link_to t('user.view.my diary'), :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %>
15     |
16     <%= link_to t('user.view.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => @this_user.display_name %>
17     |
18     <%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
19     <% if @user.active_blocks.count > 0 %>
20       |
21       <%= link_to t('user.view.blocks on me'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @user.display_name %>
22       <span class='count-number'><%= number_with_delimiter(@this_user.active_blocks.count) %></span>
23     <% end %>
24     <% if @user and @user.moderator? %>
25       | <%= link_to t('user.view.blocks by me'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => @user.display_name %>
26     <% end %>
27   <% else %>
28     <%= link_to t('user.view.edits'), :controller => 'changeset', :action => 'list', :display_name => @this_user.display_name %>
29     <span class='count-number'><%= number_with_delimiter(@this_user.changesets.size) %></span>
30     |
31     <%= link_to t('user.view.traces'), :controller => 'trace', :action => 'list', :display_name => @this_user.display_name %>
32     <span class='count-number'><%= number_with_delimiter(@this_user.traces.size) %></span>
33     |
34     <!-- Displaying another user's profile page -->
35     <%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @this_user.display_name %>
36     |
37     <%= link_to t('user.view.comments'), :controller => 'diary_entry', :action => 'comments', :display_name => @this_user.display_name %>
38     |
39     <% if @user and @user.is_friends_with?(@this_user) %>
40       <%= link_to t('user.view.remove as friend'), :controller => 'user', :action => 'remove_friend', :display_name => @this_user.display_name %>
41     <% else %>
42       <%= link_to t('user.view.add as friend'), :controller => 'user', :action => 'make_friend', :display_name => @this_user.display_name %>
43     <% end %>
44     |
45     <%= link_to t('user.view.block_history'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @this_user.display_name %>
46     <% if @this_user.moderator? %>
47       | <%= link_to t('user.view.moderator_history'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => @this_user.display_name %>
48     <% end %>
49     <% if @user and @user.moderator? %>
50       | <%= link_to t('user.view.create_block'), :controller => 'user_blocks', :action => 'new', :display_name => @this_user.display_name %>
51     <% end %>
52   <% end %>
53   <% if @user and @user.administrator? %>
54     <br/>
55     <% if ["active", "confirmed"].include? @this_user.status %>
56       <%= 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') } %> |
57     <% elsif ["pending"].include? @this_user.status %>
58       <%= 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') } %> |
59     <% end %>
60     <% if ["active", "suspended"].include? @this_user.status %>
61       <%= 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') } %> |
62     <% end %>
63     <% if ["pending", "active", "confirmed", "suspended"].include? @this_user.status %>
64       <%= 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') } %> |
65     <% else %>
66       <%= 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') } %> |
67     <% end %>
68     <%= link_to t('user.view.delete_user'), delete_user_path(:display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %>
69   <% end %>
70 </div>
71
72 <p><b><%= t 'user.view.mapper since' %></b> <%= l @this_user.creation_time, :format => :friendly %> <%= t 'user.view.ago', :time_in_words_ago => time_ago_in_words(@this_user.creation_time) %></p>
73
74 <p><b><%= t 'user.view.ct status' %></b>
75 <% if not @this_user.terms_agreed.nil? -%>
76 <%= t 'user.view.ct accepted', :ago =>time_ago_in_words(@this_user.terms_agreed)  %> 
77 <% elsif not @this_user.terms_seen? -%>
78 <%= t 'user.view.ct undecided' %>
79 <% else -%>
80 <%= t 'user.view.ct declined' %>
81 <% end -%>
82 </p>
83
84 <% if @user and @user.administrator? -%>
85   <p><b><%= t 'user.view.email address' %></b> <%= @this_user.email %></p>  
86   <% unless @this_user.creation_ip.nil? -%>
87   <p><b><%= t 'user.view.created from' %></b> <%= @this_user.creation_ip %></p>
88   <% end -%>
89   <p><b><%= t 'user.view.status' %></b> <%= @this_user.status.capitalize %></p>
90   <p><b><%= t 'user.view.spam score' %></b> <%= @this_user.spam_score %></p>
91 <% end -%>
92
93 <h3><%= t 'user.view.description' %></h3>
94
95 <div id="description"><%= @this_user.description.to_html %></div>
96
97 <% if @user and @this_user.id == @user.id %>
98   <div id="map" class="user_map">
99     <% if @this_user.home_lat.nil? or @this_user.home_lon.nil? %>
100       <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>
101     <% else %>
102       <%= render :partial => 'map', :locals => { :setting_location => false, :show_other_users => true } %>
103     <% end %>
104   </div>
105
106   <% friends = @this_user.friends.collect { |f| f.befriendee } %>
107   <% nearby = @this_user.nearby - friends %>
108
109   <h3 style="margin-top: 0"><%= t 'user.view.your friends' %></h3>
110
111   <% if friends.empty? %>
112     <%= t 'user.view.no friends' %>
113   <% else %>
114     <%= link_to t('user.view.friends_changesets'), friend_changesets_path %><br/>
115     <%= link_to t('user.view.friends_diaries'), friend_diaries_path %><br/><br/>
116     <table id="friends">
117       <%= render :partial => "contact", :collection => friends %>
118     </table>
119   <% end %>
120
121   <h3><%= t 'user.view.nearby users' %></h3>
122
123   <% if nearby.empty? %>
124     <%= t 'user.view.no nearby users' %>
125   <% else %>
126     <%= link_to t('user.view.nearby_changesets'), nearby_changesets_path %><br/>
127     <%= link_to t('user.view.nearby_diaries'), nearby_diaries_path %><br/><br/>
128     <table id="nearbyusers">
129       <%= render :partial => "contact", :collection => nearby %>
130     </table>
131   <% end %>
132 <% end %>