Fix pluralization of due dates. (No more "Due in 1 days")

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@438 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-02-13 05:48:47 +00:00
parent 468ad81122
commit 21cd0f04cf

View file

@ -63,21 +63,21 @@ module ApplicationHelper
case days
# overdue or due very soon! sound the alarm!
when -1000..-1
"<a title='" + format_date(due) + "'><span class=\"red\">Overdue by " + (days * -1).to_s + " days</span></a> "
"<a title='#{format_date(due)}'><span class=\"red\">Overdue by #{pluralize(days * -1, 'day')}</span></a> "
when 0
"<a title='" + format_date(due) + "'><span class=\"amber\">Due Today</span></a> "
"<a title='#{format_date(due)}'><span class=\"amber\">Due Today</span></a> "
when 1
"<a title='" + format_date(due) + "'><span class=\"amber\">Due Tomorrow</span></a> "
"<a title='#{format_date(due)}'><span class=\"amber\">Due Tomorrow</span></a> "
# due 2-7 days away
when 2..7
if @user.prefs.due_style == "1"
"<a title='" + format_date(due) + "'><span class=\"orange\">Due on " + due.strftime("%A") + "</span></a> "
"<a title='#{format_date(due)}'><span class=\"orange\">Due on #{due.strftime("%A")}</span></a> "
else
"<a title='" + format_date(due) + "'><span class=\"orange\">Due in " + days.to_s + " days</span></a> "
"<a title='#{format_date(due)}'><span class=\"orange\">Due in #{pluralize(days, 'day')}</span></a> "
end
# more than a week away - relax
else
"<a title='" + format_date(due) + "'><span class=\"green\">Due in " + days.to_s + " days</span></a> "
"<a title='#{format_date(due)}'><span class=\"green\">Due in #{pluralize(days, 'day')}</span></a> "
end
end