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 %>
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 %>
20 <%= link_to 'add as friend', :controller => 'user', :action => 'make_friend', :display_name => @this_user.display_name %>
25 <% if @this_user != nil %>
27 <b>Mapper since : </b><%= @this_user.creation_time %> (<%= time_ago_in_words(@this_user.creation_time) %> ago)
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' %>
40 <% if @user and @this_user.id == @user.id %>
42 <%= form_tag({:action=>'upload_image'}, :multipart => true)%>
43 <%= file_column_field 'user', 'image' %>
44 <%= submit_tag 'Add Image' %>
49 <div id="description"><%= htmlize(@this_user.description) %></div>
51 <% if @this_user.home_lat.nil? or @this_user.home_lon.nil? %>
52 <h3>User location</h3>
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.
60 <% if @user and @this_user.id == @user.id %>
62 <% if @this_user.friends.empty? %>
63 You have not added any friends yet.
66 <% @this_user.friends.each do |friend| %>
67 <% @friend = User.find_by_id(friend.friend_user_id) %>
70 <% if @friend.image %>
71 <%= image_tag url_for_file_column(@friend, "image") %>
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>
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.
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| %>
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>
108 <% if @user and @this_user.id == @user.id %>
109 <%= link_to 'change your settings', :controller => 'user', :action => 'account', :display_name => @user.display_name %>