]> git.openstreetmap.org Git - rails.git/blob - app/views/user/view.html.erb
When a user hasn't made any blocks or been blocked don't display a
[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 <% else %>
22 <!-- Displaying another user's profile page -->
23 <%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @this_user.display_name %>
24 | <%= link_to t('user.view.diary'), :controller => 'diary_entry', :action => 'list', :display_name => @this_user.display_name %>
25 | <%= link_to t('user.view.edits'), :controller => 'changeset', :action => 'list', :display_name => @this_user.display_name %>
26 | <%= link_to t('user.view.traces'), :controller => 'trace', :action => 'view', :display_name => @this_user.display_name %>
27 | <% if @user and @user.is_friends_with?(@this_user) %>
28   <%= link_to t('user.view.remove as friend'), :controller => 'user', :action => 'remove_friend', :display_name => @this_user.display_name %>
29 <% else %>
30   <%= link_to t('user.view.add as friend'), :controller => 'user', :action => 'make_friend', :display_name => @this_user.display_name %>
31 <% end %>
32 | <%= link_to t('user.view.block_history'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @this_user.display_name %>
33 <% if @this_user.moderator? %>
34 | <%= link_to t('user.view.moderator_history'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => @this_user.display_name %>
35 <% end %>
36 <% if @user and @user.moderator? %>
37 | <%= link_to t('user.view.create_block'), :controller => 'user_blocks', :action => 'new', :display_name => @this_user.display_name %>
38 <% end %>
39 <% end %>
40 </div>
41
42 <% if @this_user != nil %>
43 <P>
44 <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) %>
45 </P>
46 <% end %>
47   
48 <h3><%= t 'user.view.user image heading' %></h3>
49 <% if @this_user.image %>
50   <%= image_tag url_for_file_column(@this_user, "image") %>
51   <% if @user and @this_user.id == @user.id %>
52     <%= button_to t('user.view.delete image'), :action => 'delete_image' %>
53   <% end %>
54 <% end %>
55 <br />
56
57 <% if @user and @this_user.id == @user.id %>
58   <%= t 'user.view.upload an image' %><br />
59   <%= form_tag({:action=>'upload_image'}, :multipart => true)%>
60     <%= file_column_field 'user', 'image' %>
61     <%= submit_tag t('user.view.add image') %>
62   </form>
63 <% end %>
64
65 <h3><%= t 'user.view.description' %></h3>
66 <div id="description"><%= htmlize(@this_user.description) %></div>
67
68 <% if @this_user.home_lat.nil? or @this_user.home_lon.nil? %>
69 <h3><%= t 'user.view.user location' %></h3>
70
71   <%= t 'user.view.no home location' %>
72   <% if @user and @this_user.id == @user.id %>
73   <%= 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) %>
74   <% end %>
75 <% else %>
76
77   <% if @user and @this_user.id == @user.id %>
78     <h3><%= t 'user.view.your friends' %></h3>
79     <% if @this_user.friends.empty? %>
80       <%= t 'user.view.no friends' %>
81     <% else %>
82       <table id="friends">
83       <% @this_user.friends.each do |friend| %>
84       <% @friend = User.find_by_id(friend.friend_user_id) %>
85       <tr>
86       <td class="image">
87       <% if @friend.image %>
88         <%= image_tag url_for_file_column(@friend, "image") %>
89       <% end %>
90       </td>
91       <td class="username"><%= link_to h(@friend.display_name), :controller => 'user', :action => 'view',  :display_name => @friend.display_name %></td>
92       <td>
93         <% if @friend.home_lon and @friend.home_lat %>
94           <% distance = @this_user.distance(@friend) %>
95           <% if distance < 1 %>
96             <%= t 'user.view.m away', :count => (distance * 1000).round %>
97           <% else %>
98             <%= t 'user.view.km away', :count => distance.round %>
99           <% end %>
100         <% end %>
101       </td>
102       <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @friend.display_name %>)</td>
103       </tr>
104       <%end%>
105       </table>
106     <%end%>
107     <br/>
108   <%end%>
109
110
111   <% if @user and @this_user.id == @user.id %>
112     <h3><%= t 'user.view.nearby users' %></h3>
113     <% if @this_user.nearby.empty? %>
114       <%= t 'user.view.no nearby users' %>
115     <% else %>
116
117     <div id="map" style="border: 1px solid black; position: relative; width : 90%; height : 400px;"></div>
118     <%= render :partial => 'friend_map' %>
119       <table id="nearbyusers">
120       <% @this_user.nearby.each do |nearby| %>
121       <tr>
122       <td class="username"><%= link_to h(nearby.display_name), :controller => 'user', :action => 'view',  :display_name => nearby.display_name %></td>
123       <td>
124         <% distance = @this_user.distance(nearby) %>
125         <% if distance < 1 %>
126           <%= t 'user.view.m away', :count => (distance * 1000).round %>
127         <% else %>
128           <%= t 'user.view.km away', :count => distance.round %>
129         <% end %>
130       </td>
131       <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => nearby.display_name %>)</td>
132       </tr>
133       <% end %>
134       </table>
135     <% end %>
136   <% end %>
137 <% end %>
138
139 <br/>
140 <br/>
141 <% if @user and @this_user.id == @user.id %>
142 <%= link_to t('user.view.change your settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
143 <br/><br/>
144 <%= link_to t('user.view.my_oauth_details'), :controller => 'oauth_clients', :action => 'index' %>
145 <% end %>