]> git.openstreetmap.org Git - rails.git/blob - app/views/user/view.html.erb
Preserve parameters in pagination links.
[rails.git] / app / views / user / view.html.erb
1 <h2><%= h(@this_user.display_name) %>
2 <% UserRole::ALL_ROLES.each do |role| %>
3 <% if @user and @user.administrator? %>
4 <% if @this_user.has_role? role %>
5 <%= link_to(image_tag("roles/#{role}.png", :size => "20x20", :border => 0, :alt => t("user.view.role.revoke.#{role}"), :title => t("user.view.role.revoke.#{role}")), :controller => 'user_roles', :action => 'revoke', :display_name => @this_user.display_name, :role => role) %>
6 <% else %>
7 <%= link_to(image_tag("roles/blank_#{role}.png", :size => "20x20", :border => 0, :alt => t("user.view.role.grant.#{role}"), :title => t("user.view.role.grant.#{role}")), :controller => 'user_roles', :action => 'grant', :display_name => @this_user.display_name, :role => role) %>
8 <% end %>
9 <% elsif @this_user.has_role? role %>
10 <%= image_tag("roles/#{role}.png", :size => "20x20", :border => 0, :alt => t("user.view.role.#{role}"), :title => t("user.view.role.#{role}")) %>
11 <% end %>
12 <% end %></h2>
13 <div id="userinformation">
14 <% if @user and @this_user.id == @user.id %>
15 <!-- Displaying user's own profile page -->
16 <%= link_to t('user.view.my diary'), :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %>
17 | <%= link_to t('user.view.new diary entry'), :controller => 'diary_entry', :action => 'new', :display_name => @user.display_name %>
18 | <%= link_to t('user.view.my edits'), :controller => 'changeset', :action => 'list', :display_name => @user.display_name %>
19 | <%= link_to t('user.view.my traces'), :controller => 'trace', :action=>'mine' %>
20 | <%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
21 | <%= link_to t('user.view.blocks on me'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @user.display_name %>
22 <% if @user and @user.moderator? %>
23 | <%= link_to t('user.view.blocks by me'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => @user.display_name %>
24 <% end %>
25 <% else %>
26 <!-- Displaying another user's profile page -->
27 <%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @this_user.display_name %>
28 | <%= link_to t('user.view.diary'), :controller => 'diary_entry', :action => 'list', :display_name => @this_user.display_name %>
29 | <%= link_to t('user.view.edits'), :controller => 'changeset', :action => 'list', :display_name => @this_user.display_name %>
30 | <%= link_to t('user.view.traces'), :controller => 'trace', :action => 'view', :display_name => @this_user.display_name %>
31 | <% if @user and @user.is_friends_with?(@this_user) %>
32   <%= link_to t('user.view.remove as friend'), :controller => 'user', :action => 'remove_friend', :display_name => @this_user.display_name %>
33 <% else %>
34   <%= link_to t('user.view.add as friend'), :controller => 'user', :action => 'make_friend', :display_name => @this_user.display_name %>
35 <% end %>
36 | <%= link_to t('user.view.block_history'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @this_user.display_name %>
37 <% if @this_user.moderator? %>
38 | <%= link_to t('user.view.moderator_history'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => @this_user.display_name %>
39 <% end %>
40 <% if @user and @user.moderator? %>
41 | <%= link_to t('user.view.create_block'), :controller => 'user_blocks', :action => 'new', :display_name => @this_user.display_name %>
42 <% end %>
43 <% end %>
44 <% if @user and @user.administrator? %>
45 <br/>
46 <% if @this_user.active? %>
47 <%= link_to t('user.view.deactivate_user'), {:controller => 'user', :action => 'deactivate', :display_name => @this_user.display_name}, {:confirm => t('user.view.confirm')} %>
48 <% else %>
49 <%= link_to t('user.view.activate_user'), {:controller => 'user', :action => 'activate', :display_name => @this_user.display_name}, {:confirm => t('user.view.confirm')} %>
50 <% end %>
51 <% if @this_user.visible? %>
52 | <%= link_to t('user.view.hide_user'), {:controller => 'user', :action => 'hide', :display_name => @this_user.display_name}, {:confirm => t('user.view.confirm')} %>
53 | <%= link_to t('user.view.delete_user'), {:controller => 'user', :action => 'delete', :display_name => @this_user.display_name}, {:confirm => t('user.view.confirm')} %>
54 <% else %>
55 | <%= link_to t('user.view.unhide_user'), {:controller => 'user', :action => 'unhide', :display_name => @this_user.display_name}, {:confirm => t('user.view.confirm')} %>
56 <% end %>
57 <% end %>
58 </div>
59
60 <p><b><%= t 'user.view.mapper since' %></b> <%= l @this_user.creation_time %> <%= t 'user.view.ago', :time_in_words_ago => time_ago_in_words(@this_user.creation_time) %></p>
61
62 <% if @user and @user.administrator? %>
63 <p><b><%= t 'user.view.email address' %></b> <%= @this_user.email %></p>  
64 <p><b><%= t 'user.view.created from' %></b> <%= @this_user.creation_ip %></p>
65 <% end %>
66
67 <h3><%= t 'user.view.user image heading' %></h3>
68 <% if @this_user.image %>
69   <%= image_tag url_for_file_column(@this_user, "image") %>
70   <% if @user and @this_user.id == @user.id %>
71     <%= button_to t('user.view.delete image'), :action => 'delete_image' %>
72   <% end %>
73 <% end %>
74 <br />
75
76 <% if @user and @this_user.id == @user.id %>
77   <%= t 'user.view.upload an image' %><br />
78   <%= form_tag({:action=>'upload_image'}, :multipart => true)%>
79     <%= file_column_field 'user', 'image' %>
80     <%= submit_tag t('user.view.add image') %>
81   </form>
82 <% end %>
83
84 <h3><%= t 'user.view.description' %></h3>
85 <div id="description"><%= htmlize(@this_user.description) %></div>
86
87 <% if @this_user.home_lat.nil? or @this_user.home_lon.nil? %>
88 <h3><%= t 'user.view.user location' %></h3>
89
90   <%= t 'user.view.no home location' %>
91   <% if @user and @this_user.id == @user.id %>
92   <%= 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) %>
93   <% end %>
94 <% else %>
95
96   <% if @user and @this_user.id == @user.id %>
97     <h3><%= t 'user.view.your friends' %></h3>
98     <% if @this_user.friends.empty? %>
99       <%= t 'user.view.no friends' %>
100     <% else %>
101       <table id="friends">
102       <% @this_user.friends.each do |friend| %>
103       <% @friend = User.find_by_id(friend.friend_user_id) %>
104       <tr>
105       <td class="image">
106       <% if @friend.image %>
107         <%= image_tag url_for_file_column(@friend, "image") %>
108       <% end %>
109       </td>
110       <td class="username"><%= link_to h(@friend.display_name), :controller => 'user', :action => 'view',  :display_name => @friend.display_name %></td>
111       <td>
112         <% if @friend.home_lon and @friend.home_lat %>
113           <% distance = @this_user.distance(@friend) %>
114           <% if distance < 1 %>
115             <%= t 'user.view.m away', :count => (distance * 1000).round %>
116           <% else %>
117             <%= t 'user.view.km away', :count => distance.round %>
118           <% end %>
119         <% end %>
120       </td>
121       <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @friend.display_name %>)</td>
122       </tr>
123       <%end%>
124       </table>
125     <%end%>
126     <br/>
127   <%end%>
128
129
130   <% if @user and @this_user.id == @user.id %>
131     <h3><%= t 'user.view.nearby users' %></h3>
132     <% if @this_user.nearby.empty? %>
133       <%= t 'user.view.no nearby users' %>
134     <% else %>
135
136     <div id="map" style="border: 1px solid black; position: relative; width : 90%; height : 400px;"></div>
137     <%= render :partial => 'friend_map' %>
138       <table id="nearbyusers">
139       <% @this_user.nearby.each do |nearby| %>
140       <tr>
141       <td class="username"><%= link_to h(nearby.display_name), :controller => 'user', :action => 'view',  :display_name => nearby.display_name %></td>
142       <td>
143         <% distance = @this_user.distance(nearby) %>
144         <% if distance < 1 %>
145           <%= t 'user.view.m away', :count => (distance * 1000).round %>
146         <% else %>
147           <%= t 'user.view.km away', :count => distance.round %>
148         <% end %>
149       </td>
150       <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => nearby.display_name %>)</td>
151       </tr>
152       <% end %>
153       </table>
154     <% end %>
155   <% end %>
156 <% end %>
157
158 <br/>
159 <br/>
160 <% if @user and @this_user.id == @user.id %>
161 <%= link_to t('user.view.change your settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
162 <br/><br/>
163 <%= link_to t('user.view.my_oauth_details'), :controller => 'oauth_clients', :action => 'index' %>
164 <% end %>