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