foodsoft/app/helpers/tasks_helper.rb
2011-05-14 19:02:52 +02:00

16 lines
546 B
Ruby

module TasksHelper
def task_assignments(task)
task.assignments.map do |ass|
content_tag :span, ass.user.nick, :class => (ass.accepted? ? 'accepted' : 'unaccepted')
end.join(", ").html_safe
end
# generate colored number of still required users
def highlighted_required_users(task)
unless task.enough_users_assigned?
still_required = task.required_users - task.assignments.select { |ass| ass.accepted }.size
"<small style='color:red;font-weight:bold'>(#{still_required})</small>".html_safe
end
end
end