Show the latest changeset for each of the contacts on the user page

This commit is contained in:
Andy Allan 2010-12-17 13:36:53 +00:00
parent 6d51e77880
commit 33a039e849
3 changed files with 17 additions and 2 deletions

View file

@ -10,7 +10,7 @@ class User < ActiveRecord::Base
has_many :friends, :include => :befriendee, :conditions => "users.status IN ('active', 'confirmed')"
has_many :tokens, :class_name => "UserToken"
has_many :preferences, :class_name => "UserPreference"
has_many :changesets
has_many :changesets, :order => 'created_at DESC'
has_many :client_applications
has_many :oauth_tokens, :class_name => "OauthToken", :order => "authorized_at desc", :include => [:client_application]

View file

@ -1,5 +1,5 @@
<tr>
<td rowspan="2">
<td rowspan="3">
<%= user_thumbnail contact %>
</td>
<td>
@ -14,6 +14,20 @@
<% end %>
</td>
</tr>
<tr>
<td>
<% changeset = contact.changesets.first %>
<% if changeset %>
<%= t('user.view.latest edit', :ago => t('user.view.ago', :time_in_words_ago => time_ago_in_words(changeset.created_at))) %>
<% comment = changeset.tags['comment'] ? changeset.tags['comment'] : t('changeset.changeset.no_comment') %>
"<%= link_to(comment,
{:controller => 'browse', :action => 'changeset', :id => changeset.id},
{:title => t('changeset.changeset.view_changeset_details')})
%>"
<% else %>
<%= t'changeset.changeset.no_edits' %>
<% end %>
</td>
<tr>
<td>
<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => contact.display_name %>