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 2007/12/12 00:15:52 UTC
svn commit: r603408 - /ode/sandbox/singleshot/app/helpers/task_helper.rb
Author: assaf
Date: Tue Dec 11 15:15:51 2007
New Revision: 603408
URL: http://svn.apache.org/viewvc?rev=603408&view=rev
Log:
One more thing ...
Added:
ode/sandbox/singleshot/app/helpers/task_helper.rb
Added: ode/sandbox/singleshot/app/helpers/task_helper.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/helpers/task_helper.rb?rev=603408&view=auto
==============================================================================
--- ode/sandbox/singleshot/app/helpers/task_helper.rb (added)
+++ ode/sandbox/singleshot/app/helpers/task_helper.rb Tue Dec 11 15:15:51 2007
@@ -0,0 +1,41 @@
+module TaskHelper
+
+ def task_bar_vitals(task, person = authenticated)
+ case task.status
+ when :suspended
+ vitals = 'suspended'
+ when :cancelled
+ vitals = "cancelled #{relative_date_with_abbr(task.updated_at)}"
+ when :completed
+ vitals = "completed #{relative_date_with_abbr(task.updated_at)} by #{link_to_person(task.owner)}"
+ else
+ vitals = []
+ if creator = task.creator
+ vitals << "created by #{link_to_person(task.creator)}" unless creator == person
+ end
+ if owner = task.owner
+ vitals << (person == owner ? 'assigned to you' : 'assigned to ' + link_to_person(owner))
+ end
+ vitals << "due #{relative_date_with_abbr(task.due_on)}" if task.due_on
+ priority = [nil, 'medium', 'high'][task.priority - 1]
+ vitals << "#{priority} priority" if priority
+ end
+ Array(vitals).join(', ').gsub(/^\w/) { |w| w.upcase }
+ end
+
+ def task_bar_actions(task, person = authenticated)
+ if task.active? && task.can_claim?(person)
+ button_to('Claim Task', task_url(task, 'task[owner]'=>person.to_param), :method=>:put,
+ :title=>'Claim ownership and perform this task')
+ end
+ end
+
+ def task_iframe_url(task, person = authenticated)
+ task_uri = URI(task_url(task))
+ task_uri.user, task_uri.password = '_token', task.token_for(person)
+ uri = URI(task.frame_url)
+ uri.query = CGI.parse(uri.query || '').update('perform'=>task.owner?(person), 'task_url'=>task_uri).to_query
+ uri.to_s
+ end
+
+end