]> git.openstreetmap.org Git - rails.git/blob - app/views/user/view.rhtml
Improve layout of user options page.
[rails.git] / app / views / user / view.rhtml
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_user', :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', :user_id => @this_user.id %>
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_user', :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><% if @friend.home_lon and @friend.home_lat %><%= t 'user.view.km away', :distance => l(@this_user.distance(@friend).round) %><% end %></td>
75       <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :user_id => @friend.id %>)</td>
76       </tr>
77       <%end%>
78       </table>
79     <%end%>
80     <br/>
81   <%end%>
82
83
84   <% if @user and @this_user.id == @user.id %>
85     <h3><%= t 'user.view.nearby users' %></h3>
86     <% if @this_user.nearby.empty? %>
87       <%= t 'user.view.no nearby users' %>
88     <% else %>
89
90     <div id="map" style="border: 1px solid black; position: relative; width : 90%; height : 400px;"></div>
91     <%= render :partial => 'friend_map' %>
92       <table id="nearbyusers">
93       <% @this_user.nearby.each do |nearby| %>
94       <tr>
95       <td class="username"><%= link_to h(nearby.display_name), :controller => 'user', :action => 'view',  :display_name => nearby.display_name %></td>
96       <td><%= t 'user.view.no nearby users', :distance => l(@this_user.distance(nearby).round) %></td>
97       <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :user_id => nearby.id %>)</td>
98       </tr>
99       <% end %>
100       </table>
101     <% end %>
102   <% end %>
103 <% end %>
104
105 <br/>
106 <br/>
107 <% if @user and @this_user.id == @user.id %>
108 <%= link_to t('user.view.change your settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
109 <% end %>