]> git.openstreetmap.org Git - rails.git/blob - app/views/user/view.rhtml
Add missing files from api06 merge.
[rails.git] / app / views / user / view.rhtml
1 <% @this_user = User.find_by_display_name(@this_user.display_name) %>
2 <h2><%= h(@this_user.display_name) %></h2>
3 <div id="userinformation">
4 <% if @user and @this_user.id == @user.id %>
5 <!-- Displaying user's own profile page -->
6 <%= link_to 'my diary', :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %>
7 | <%= link_to 'new diary entry', :controller => 'diary_entry', :action => 'new', :display_name => @user.display_name %>
8 | <%= link_to 'my edits', :controller => 'changeset', :action => 'list_user', :display_name => @user.display_name %>
9 | <%= link_to 'my traces', :controller => 'trace', :action=>'mine' %>
10 | <%= link_to 'my settings', :controller => 'user', :action => 'account', :display_name => @user.display_name %>
11 <% else %>
12 <!-- Displaying another user's profile page -->
13 <%= link_to 'send message', :controller => 'message', :action => 'new', :user_id => @this_user.id %>
14 | <%= link_to 'diary', :controller => 'diary_entry', :action => 'list', :display_name => @this_user.display_name %>
15 | <%= link_to 'edits', :controller => 'changeset', :action => 'list_user', :display_name => @this_user.display_name %>
16 | <%= link_to 'traces', :controller => 'trace', :action => 'view', :display_name => @this_user.display_name %>
17 | <% if @user and @user.is_friends_with?(@this_user) %>
18   <%= link_to 'remove as friend', :controller => 'user', :action => 'remove_friend', :display_name => @this_user.display_name %>
19 <% else %>
20   <%= link_to 'add as friend', :controller => 'user', :action => 'make_friend', :display_name => @this_user.display_name %>
21 <% end %>
22 <% end %>
23 </div>
24
25 <% if @this_user != nil %>
26 <P>
27 <b>Mapper since : </b><%= @this_user.creation_time %> (<%= time_ago_in_words(@this_user.creation_time) %> ago)
28 </P>
29 <% end %>
30   
31 <h3>User image</h3>
32 <% if @this_user.image %>
33   <%= image_tag url_for_file_column(@this_user, "image") %>
34   <% if @user and @this_user.id == @user.id %>
35     <%= button_to 'Delete Image', :action => 'delete_image' %>
36   <% end %>
37 <% end %>
38 <br />
39
40 <% if @user and @this_user.id == @user.id %>
41   Upload an image<br />
42   <%= form_tag({:action=>'upload_image'}, :multipart => true)%>
43     <%= file_column_field 'user', 'image' %>
44     <%= submit_tag 'Add Image' %>
45   </form>
46 <% end %>
47
48 <h3>Description</h3>
49 <div id="description"><%= htmlize(@this_user.description) %></div>
50
51 <% if @this_user.home_lat.nil? or @this_user.home_lon.nil? %>
52 <h3>User location</h3>
53
54   No home location has been set.
55   <% if @user and @this_user.id == @user.id %>
56   If you set your location, a pretty map and stuff will appear below. You can set your home location on your <%= link_to 'settings', :controller => 'user', :action => 'account', :display_name => @user.display_name %> page.
57   <% end %>
58 <% else %>
59
60   <% if @user and @this_user.id == @user.id %>
61     <h3>Your friends</h3>
62     <% if @this_user.friends.empty? %>
63       You have not added any friends yet.
64     <% else %>
65       <table id="friends">
66       <% @this_user.friends.each do |friend| %>
67       <% @friend = User.find_by_id(friend.friend_user_id) %>
68       <tr>
69       <td class="image">
70       <% if @friend.image %>
71         <%= image_tag url_for_file_column(@friend, "image") %>
72       <% end %>
73       </td>
74       <td class="username"><%= link_to h(@friend.display_name), :controller => 'user', :action => 'view',  :display_name => @friend.display_name %></td>
75       <td><% if @friend.home_lon and @friend.home_lat %><%= @this_user.distance(@friend).round %>km away<% end %></td>
76       <td class="message">(<%= link_to 'send message', :controller => 'message', :action => 'new', :user_id => @friend.id %>)</td>
77       </tr>
78       <%end%>
79       </table>
80     <%end%>
81     <br/>
82   <%end%>
83
84
85   <% if @user and @this_user.id == @user.id %>
86     <h3>Nearby users:</h3>
87     <% if @this_user.nearby.empty? %>
88       There are no users who admit to mapping nearby yet.
89     <% else %>
90
91     <div id="map" style="border: 1px solid black; position: relative; width : 90%; height : 400px;"></div>
92     <%= render :partial => 'friend_map' %>
93       <table id="nearbyusers">
94       <% @this_user.nearby.each do |nearby| %>
95       <tr>
96       <td class="username"><%= link_to h(nearby.display_name), :controller => 'user', :action => 'view',  :display_name => nearby.display_name %></td>
97       <td><%= @this_user.distance(nearby).round %>km away</td>
98       <td class="message">(<%= link_to 'send message', :controller => 'message', :action => 'new', :user_id => nearby.id %>)</td>
99       </tr>
100       <% end %>
101       </table>
102     <% end %>
103   <% end %>
104 <% end %>
105
106 <br/>
107 <br/>
108 <% if @user and @this_user.id == @user.id %>
109 <%= link_to 'change your settings', :controller => 'user', :action => 'account', :display_name => @user.display_name %>
110 <% end %>