From 2bd2d1928ee7276f674d9ace666698992fef2dc2 Mon Sep 17 00:00:00 2001 From: bsag Date: Sun, 8 Jan 2006 15:02:23 +0000 Subject: [PATCH] Added clarsen's patch to prettify due dates for the range of 2-7 days away. There's a new setting in settings.yml.tmpl which you should add to your settings.yml. If due_style is set to 1, due dates in the 2-7 days away range will have the label, 'Due on Monday' (or whatever the corresponding day of the week it is). If set to 0, the behaviour will be as before (i.e. 'Due in 4 days'). Thanks clarsen! git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@173 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/helpers/todo_helper.rb | 8 ++++++-- tracks/config/settings.yml.tmpl | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tracks/app/helpers/todo_helper.rb b/tracks/app/helpers/todo_helper.rb index 011a7680..f616e213 100644 --- a/tracks/app/helpers/todo_helper.rb +++ b/tracks/app/helpers/todo_helper.rb @@ -94,7 +94,7 @@ module TodoHelper case @days # overdue or due very soon! sound the alarm! - when -365..-1 + when -1000..-1 "Overdue by " + (@days * -1).to_s + " days " when 0 "Due Today " @@ -102,7 +102,11 @@ module TodoHelper "Due Tomorrow " # due 2-7 days away when 2..7 - "Due in " + @days.to_s + " days " + if app_configurations["formats"]["due_style"] == 1 + "Due on " + due.strftime("%A") + " " + else + "Due in " + @days.to_s + " days " + end # more than a week away - relax else "Due in " + @days.to_s + " days " diff --git a/tracks/config/settings.yml.tmpl b/tracks/config/settings.yml.tmpl index 664b2209..0c24af42 100644 --- a/tracks/config/settings.yml.tmpl +++ b/tracks/config/settings.yml.tmpl @@ -3,12 +3,15 @@ # week_starts is the day you want the calendar to display first (0=Sunday, 1=Monday etc.) # hp_completed is the number of completed items you want displayed on the home page # staleness_starts is the number of days before actions start to go yellow with age! +# due_style 0 is "due in N days" for N=2..7 +# due_style 1 is "due on weekdayname" for N=2..7 # formats: date: %d/%m/%Y week_starts: 1 hp_completed: 5 staleness_starts: 7 + due_style: 0 admin: email: butshesagirl@rousette.org.uk loginhash: change-me