]> git.openstreetmap.org Git - rails.git/blob - app/views/user/view.rhtml
Merge 7296:7427 from export branch to trunk.
[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 <%= link_to 'my diary', :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %>
6 | <%= link_to 'new diary post', :controller => 'diary_entry', :action => 'new', :display_name => @user.display_name %>
7 | <%= link_to 'my traces', :controller => 'trace', :action=>'mine' %>
8 | <%= link_to 'my settings', :controller => 'user', :action => 'account', :display_name => @user.display_name %>
9 <% else %>
10 <%= link_to 'send message', :controller => 'message', :action => 'new', :user_id => @this_user.id %>
11 | <%= link_to 'diary', :controller => 'diary_entry', :action => 'list', :display_name => @this_user.display_name %>
12 | <%= link_to 'traces', :controller => 'trace', :action => 'view', :display_name => @this_user.display_name %>
13 | <% if @user and @user.is_friends_with?(@this_user) %>
14   <%= link_to 'remove as friend', :controller => 'user', :action => 'remove_friend', :display_name => @this_user.display_name %>
15 <% else %>
16   <%= link_to 'add as friend', :controller => 'user', :action => 'make_friend', :display_name => @this_user.display_name %>
17 <% end %>
18 <% end %>
19 </div>
20
21 <h3>User image</h3>
22 <% if @this_user.image %>
23  <%= image_tag url_for_file_column(@this_user, "image") %>
24 <% end %>
25 <br />
26
27 <% if @user and @this_user.id == @user.id %>
28   Upload an image<br />
29   <%= form_tag({:action=>'upload_image'}, :multipart => true)%>
30     <%= file_column_field 'user', 'image' %>
31     <input type="submit" name="Upload" />
32   </form>
33 <% end %>
34
35 <h3>Description</h3>
36 <div id="description"><%= simple_format(@this_user.description) %></div>
37
38 <% if @this_user.home_lat.nil? or @this_user.home_lon.nil? %>
39 <h3>User location</h3>
40
41   No home location has been set.
42   <% if @user and @this_user.id == @user.id %>
43   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.
44   <% end %>
45 <% else %>
46
47   <% if @user and @this_user.id == @user.id %>
48     <h3>Your friends</h3>
49     <% if @this_user.friends.empty? %>
50       You have not added any friends yet.
51     <% else %>
52       <table id="friends">
53       <% @this_user.friends.each do |friend| %>
54       <% @friend = User.find_by_id(friend.friend_user_id) %>
55       <tr>
56       <td class="image">
57       <% if @friend.image %>
58         <%= image_tag url_for_file_column(@friend, "image") %>
59       <% end %>
60       </td>
61       <td class="username"><%= link_to h(@friend.display_name), :controller => 'user', :action => 'view',  :display_name => @friend.display_name %></td>
62       <td><% if @friend.home_lon and @friend.home_lat %><%= @this_user.distance(@friend).round %>km away<% end %></td>
63       <td class="message">(<%= link_to 'send message', :controller => 'message', :action => 'new', :user_id => @friend.id %>)</td>
64       </tr>
65       <%end%>
66       </table>
67     <%end%>
68     <br/>
69   <%end%>
70
71
72   <% if @user and @this_user.id == @user.id %>
73     <h3>Nearby users:</h3>
74     <% if @this_user.nearby.empty? %>
75       There are no users who admit to mapping nearby yet.
76     <% else %>
77
78     <div id="map" style="border: 1px solid black; position: relative; width : 90%; height : 400px;"></div>
79     <%= render :partial => 'friend_map' %>
80       <table id="nearbyusers">
81       <% @this_user.nearby.each do |nearby| %>
82       <tr>
83       <td class="username"><%= link_to h(nearby.display_name), :controller => 'user', :action => 'view',  :display_name => nearby.display_name %></td>
84       <td><%= @this_user.distance(nearby).round %>km away</td>
85       <td class="message">(<%= link_to 'send message', :controller => 'message', :action => 'new', :user_id => nearby.id %>)</td>
86       </tr>
87       <% end %>
88       </table>
89     <% end %>
90   <% end %>
91 <% end %>