From 33a039e849780a087c9ae078d9da0105c182699a Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Fri, 17 Dec 2010 13:36:53 +0000 Subject: [PATCH] Show the latest changeset for each of the contacts on the user page --- app/models/user.rb | 2 +- app/views/user/_contact.html.erb | 16 +++++++++++++++- config/locales/en.yml | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index c2d73ed98..d2535bbd4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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] diff --git a/app/views/user/_contact.html.erb b/app/views/user/_contact.html.erb index e0babce7e..bcab838ba 100644 --- a/app/views/user/_contact.html.erb +++ b/app/views/user/_contact.html.erb @@ -1,5 +1,5 @@ - + <%= user_thumbnail contact %> @@ -14,6 +14,20 @@ <% end %> + + + <% 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 %> + <%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => contact.display_name %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 74ac8e75d..b11f2f886 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1592,6 +1592,7 @@ en: add as friend: add as friend mapper since: "Mapper since:" ago: "({{time_in_words_ago}} ago)" + latest edit: "Latest edit {{ago}}:" email address: "Email address:" created from: "Created from:" status: "Status:" -- 2.43.2