]> git.openstreetmap.org Git - rails.git/blob - app/views/users/_contact.html.erb
Merge remote-tracking branch 'upstream/pull/2168'
[rails.git] / app / views / users / _contact.html.erb
1 <%
2    user_data = {
3      :lon => contact.home_lon,
4      :lat => contact.home_lat,
5      :icon => image_path(type == "friend" ? "marker-blue.png" : "marker-green.png"),
6      :description => render(:partial => "popup", :object => contact, :locals => { :type => type })
7    }
8 %>
9 <%= content_tag :div, :class => "contact-activity clearfix", :data => { :user => user_data } do %>
10   <%= user_thumbnail contact %>
11   <div class='activity-details'>
12     <p class='deemphasize'>
13       <%= link_to h(contact.display_name), user_path(contact) %>
14       <% if @user.home_lon and @user.home_lat and contact.home_lon and contact.home_lat %>
15         <% distance = @user.distance(contact) %>
16         <% if distance < 1 %>
17           (<%= t 'users.show.m away', :count => (distance * 1000).round %>)
18         <% else %>
19           (<%= t 'users.show.km away', :count => distance.round %>)
20         <% end %>
21       <% end %>
22     </p>
23     <p>
24       <% changeset = contact.changesets.first %>
25       <% if changeset %>
26         <%= t('users.show.latest edit', :ago => t('users.show.ago', :time_in_words_ago => time_ago_in_words(changeset.created_at))) %>
27         <% comment = changeset.tags['comment'].to_s != '' ? changeset.tags['comment'] : t('browse.no_comment') %>
28         "<%= link_to(comment,
29                      { :controller => 'browse', :action => 'changeset', :id => changeset.id },
30                      { :title => t('changesets.changeset.view_changeset_details') }) %>"
31       <% else %>
32        <%= t 'changesets.changeset.no_edits' %>
33       <% end %>
34     </p>
35
36     <ul class='secondary-actions clearfix deemphasize'>
37       <li><%= link_to t('users.show.send message'), new_message_path(contact) %></li>
38       <li>
39         <% if current_user.is_friends_with?(contact) %>
40           <%= link_to t('users.show.remove as friend'), remove_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
41         <% else %>
42           <%= link_to t('users.show.add as friend'), make_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
43       <% end %>
44       </li>
45     </ul>
46   </div>
47 <% end %>