]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/user/view.html.erb
Fix send message links for friends and nearby mappers. Fixes #2065.
[rails.git] / app / views / user / view.html.erb
index 6e54fbebb06b68256026f0e79f35e6cbba967140..ff349858c9229fd42916982fd0786c5fed3207f1 100644 (file)
@@ -9,7 +9,7 @@
 | <%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
 <% else %>
 <!-- Displaying another user's profile page -->
-<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :user_id => @this_user.id %>
+<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @this_user.display_name %>
 | <%= link_to t('user.view.diary'), :controller => 'diary_entry', :action => 'list', :display_name => @this_user.display_name %>
 | <%= link_to t('user.view.edits'), :controller => 'changeset', :action => 'list', :display_name => @this_user.display_name %>
 | <%= link_to t('user.view.traces'), :controller => 'trace', :action => 'view', :display_name => @this_user.display_name %>
       <% end %>
       </td>
       <td class="username"><%= link_to h(@friend.display_name), :controller => 'user', :action => 'view',  :display_name => @friend.display_name %></td>
-      <td><% if @friend.home_lon and @friend.home_lat %><%= t 'user.view.km away', :count => @this_user.distance(@friend).round %><% end %></td>
-      <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :user_id => @friend.id %>)</td>
+      <td>
+        <% if @friend.home_lon and @friend.home_lat %>
+          <% distance = @this_user.distance(@friend) %>
+          <% if distance < 1 %>
+            <%= t 'user.view.m away', :count => (distance * 1000).round %>
+          <% else %>
+            <%= t 'user.view.km away', :count => distance.round %>
+          <% end %>
+        <% end %>
+      </td>
+      <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @friend.display_name %>)</td>
       </tr>
       <%end%>
       </table>
       <% @this_user.nearby.each do |nearby| %>
       <tr>
       <td class="username"><%= link_to h(nearby.display_name), :controller => 'user', :action => 'view',  :display_name => nearby.display_name %></td>
-      <td><%= t 'user.view.km away', :count => @this_user.distance(nearby).round %></td>
-      <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :user_id => nearby.id %>)</td>
+      <td>
+        <% distance = @this_user.distance(nearby) %>
+        <% if distance < 1 %>
+          <%= t 'user.view.m away', :count => (distance * 1000).round %>
+        <% else %>
+          <%= t 'user.view.km away', :count => distance.round %>
+        <% end %>
+      </td>
+      <td class="message">(<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => nearby.display_name %>)</td>
       </tr>
       <% end %>
       </table>