]> git.openstreetmap.org Git - rails.git/blob - app/views/user/view.html.erb
Merge 16817:16819 from trunk.
[rails.git] / app / views / user / view.html.erb
1 <h2><%= h(@this_user.display_name) %></h2>
2 <div id="userinformation">
3 <% if @user and @this_user.id == @user.id %>
4 <!-- Displaying user's own profile page -->
5 <%= link_to t('user.view.my diary'), :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %>
6 | <%= link_to t('user.view.new diary entry'), :controller => 'diary_entry', :action => 'new', :display_name => @user.display_name %>
7 | <%= link_to t('user.view.my edits'), :controller => 'changeset', :action => 'list', :display_name => @user.display_name %>
8 | <%= link_to t('user.view.my traces'), :controller => 'trace', :action=>'mine' %>
9 | <%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
10 <% else %>
11 <!-- Displaying another user's profile page -->
12 <%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @this_user.display_name %>
13 | <%= link_to t('user.view.diary'), :controller => 'diary_entry', :action => 'list', :display_name => @this_user.display_name %>
14 | <%= link_to t('user.view.edits'), :controller => 'changeset', :action => 'list', :display_name => @this_user.display_name %>
15 | <%= link_to t('user.view.traces'), :controller => 'trace', :action => 'view', :display_name => @this_user.display_name %>
16 | <% if @user and @user.is_friends_with?(@this_user) %>
17   <%= link_to t('user.view.remove as friend'), :controller => 'user', :action => 'remove_friend', :display_name => @this_user.display_name %>
18 <% else %>
19   <%= link_to t('user.view.add as friend'), :controller => 'user', :action => 'make_friend', :display_name => @this_user.display_name %>
20 <% end %>
21 <% end %>
22 </div>
23
24 <% if @this_user != nil %>
25 <P>
26 <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) %>
27 </P>
28 <% end %>
29   
30 <h3><%= t 'user.view.user image heading' %></h3>
31 <% if @this_user.image %>
32   <%= image_tag url_for_file_column(@this_user, "image") %>
33   <% if @user and @this_user.id == @user.id %>
34     <%= button_to t('user.view.delete image'), :action => 'delete_image' %>
35   <% end %>
36 <% end %>
37 <br />
38
39 <% if @user and @this_user.id == @user.id %>
40   <%= t 'user.view.upload an image' %><br />
41   <%= form_tag({:action=>'upload_image'}, :multipart => true)%>
42     <%= file_column_field 'user', 'image' %>
43     <%= submit_tag t('user.view.add image') %>
44   </form>
45 <% end %>
46
47 <h3><%= t 'user.view.description' %></h3>
48 <div id="description"><%= htmlize(@this_user.description) %></div>
49
50 <% if @this_user.home_lat.nil? or @this_user.home_lon.nil? %>
51 <h3><%= t 'user.view.user location' %></h3>
52
53   <%= t 'user.view.no home location' %>
54   <% if @user and @this_user.id == @user.id %>
55   <%= 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) %>
56   <% end %>
57 <% else %>
58
59   <% if @user and @this_user.id == @user.id %>
60     <h3><%= t 'user.view.your friends' %></h3>
61     <% if @this_user.friends.empty? %>
62       <%= t 'user.view.no friends' %>
63     <% else %>
64       <table id="friends">
65       <% @this_user.friends.each do |friend| %>
66       <% @friend = User.find_by_id(friend.friend_user_id) %>
67       <tr>
68       <td class="image">
69       <% if @friend.image %>
70         <%= image_tag url_for_file_column(@friend, "image") %>
71       <% end %>
72       </td>
73       <td class="username"><%= link_to h(@friend.display_name), :controller => 'user', :action => 'view',  :display_name => @friend.display_name %></td>
74       <td>
75         <% if @friend.home_lon and @friend.home_lat %>
76           <% distance = @this_user.distance(@friend) %>
77           <% if distance < 1 %>
78             <%= t 'user.view.m away', :count => (distance * 1000).round %>
79           <% else %>
80             <%= t 'user.view.km away', :count => distance.round %>
81           <% end %>
82         <% end %>
83       </td>
84       <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @friend.display_name %>)</td>
85       </tr>
86       <%end%>
87       </table>
88     <%end%>
89     <br/>
90   <%end%>
91
92
93   <% if @user and @this_user.id == @user.id %>
94     <h3><%= t 'user.view.nearby users' %></h3>
95     <% if @this_user.nearby.empty? %>
96       <%= t 'user.view.no nearby users' %>
97     <% else %>
98
99     <div id="map" style="border: 1px solid black; position: relative; width : 90%; height : 400px;"></div>
100     <%= render :partial => 'friend_map' %>
101       <table id="nearbyusers">
102       <% @this_user.nearby.each do |nearby| %>
103       <tr>
104       <td class="username"><%= link_to h(nearby.display_name), :controller => 'user', :action => 'view',  :display_name => nearby.display_name %></td>
105       <td>
106         <% distance = @this_user.distance(nearby) %>
107         <% if distance < 1 %>
108           <%= t 'user.view.m away', :count => (distance * 1000).round %>
109         <% else %>
110           <%= t 'user.view.km away', :count => distance.round %>
111         <% end %>
112       </td>
113       <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => nearby.display_name %>)</td>
114       </tr>
115       <% end %>
116       </table>
117     <% end %>
118   <% end %>
119 <% end %>
120
121 <br/>
122 <br/>
123 <% if @user and @this_user.id == @user.id %>
124 <%= link_to t('user.view.change your settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
125 <br/><br/>
126 <%= link_to t('user.view.my_oauth_details'), :controller => 'oauth_clients', :action => 'index' %>
127 <% end %>