You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2008/05/21 02:32:00 UTC
svn commit: r658513 - in /ode/sandbox/singleshot/app:
helpers/application_helper.rb helpers/task_helper.rb models/person.rb
views/tasks/show.html.erb
Author: assaf
Date: Tue May 20 17:31:59 2008
New Revision: 658513
URL: http://svn.apache.org/viewvc?rev=658513&view=rev
Log:
link_to_person now annotates link with relationship (owner, admin, etc).
Modified:
ode/sandbox/singleshot/app/helpers/application_helper.rb
ode/sandbox/singleshot/app/helpers/task_helper.rb
ode/sandbox/singleshot/app/models/person.rb
ode/sandbox/singleshot/app/views/tasks/show.html.erb
Modified: ode/sandbox/singleshot/app/helpers/application_helper.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/helpers/application_helper.rb?rev=658513&r1=658512&r2=658513&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/helpers/application_helper.rb (original)
+++ ode/sandbox/singleshot/app/helpers/application_helper.rb Tue May 20 17:31:59 2008
@@ -3,10 +3,15 @@
# Returns a link to a person using their full name as the link text and site URL
# (or profile, if unspecified) as the reference.
- def link_to_person(person, options = {})
+ def link_to_person(person, *args)
+ options = args.extract_options!
fullname = h(person.fullname)
- person.identity ? link_to(fullname, person.identity, options.reverse_merge(:title=>"See #{fullname}'s profile")) :
- content_tag('span', fullname, options)
+ if person.url
+ options.update :rel=>args.first if args.first
+ link_to(fullname, person.url, options.merge(:title=>"See #{fullname}'s profile"))
+ else
+ content_tag('span', fullname)
+ end
end
# Returns Person object for currently authenticated user.
Modified: ode/sandbox/singleshot/app/helpers/task_helper.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/helpers/task_helper.rb?rev=658513&r1=658512&r2=658513&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/helpers/task_helper.rb (original)
+++ ode/sandbox/singleshot/app/helpers/task_helper.rb Tue May 20 17:31:59 2008
@@ -13,8 +13,8 @@
def task_vitals(task)
vitals = ['Created ' + relative_date_abbr(task.created_at, :class=>'published')]
- vitals.first << ' by ' + link_to_person(task.creator) if task.creator
- vitals << (task.status == 'completed' ? "completed by " : "assigned to ") + link_to_person(task.owner) if task.owner
+ vitals.first << ' by ' + link_to_person(task.creator, :creator) if task.creator
+ vitals << (task.status == 'completed' ? "completed by " : "assigned to ") + link_to_person(task.owner, :owner) if task.owner
vitals << "due #{relative_date_abbr(task.due_on)}" if task.due_on
vitals.to_sentence
end
Modified: ode/sandbox/singleshot/app/models/person.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/person.rb?rev=658513&r1=658512&r2=658513&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/person.rb (original)
+++ ode/sandbox/singleshot/app/models/person.rb Tue May 20 17:31:59 2008
@@ -113,4 +113,8 @@
save! unless new_record?
end
+ def url
+ read_attribute(:identity)
+ end
+
end
Modified: ode/sandbox/singleshot/app/views/tasks/show.html.erb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/tasks/show.html.erb?rev=658513&r1=658512&r2=658513&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/show.html.erb (original)
+++ ode/sandbox/singleshot/app/views/tasks/show.html.erb Tue May 20 17:31:59 2008
@@ -27,9 +27,9 @@
<% end %>
</ol>
</dd>
- <%= admins = @task.admins.map { |admin| link_to_person(admin) }
+ <%= admins = @task.admins.map { |person| link_to_person(person, :admin) }
content_tag('dt', 'Admins') + content_tag('dd', admins.to_sentence) unless admins.empty? %>
- <%= observers = @task.observers.map { |admin| link_to_person(admin) }
+ <%= observers = @task.observers.map { |person| link_to_person(person, :observer) }
content_tag('dt', 'Observers') + content_tag('dd', observers.to_sentence) unless observers.empty? %>
</dl>
<div class='actions' style='text-align:right'>