diff --git a/tracks/app/controllers/application.rb b/tracks/app/controllers/application.rb index 6ddab9c3..5fd627c2 100644 --- a/tracks/app/controllers/application.rb +++ b/tracks/app/controllers/application.rb @@ -11,22 +11,23 @@ class ApplicationController < ActionController::Base include LoginSystem # Contstants from settings.yml - DATE_FORMAT = app_configurations["formats"]["date"] + DATE_FORMAT = app_configurations["formats"]["date"] WEEK_STARTS_ON = app_configurations["formats"]["week_starts"] - NO_OF_ACTIONS = app_configurations["formats"]["hp_completed"] + NO_OF_ACTIONS = app_configurations["formats"]["hp_completed"] + STALENESS_STARTS = app_configurations["formats"]["staleness_starts"] def count_shown_items(hidden) - count = 0 - sub = 0 - hidden.each do |h| - sub = Todo.find_all("done=0 AND context_id=#{h.id}").length + sub - end - total = Todo.find_all("done=0").length - sub + count = 0 + sub = 0 + hidden.each do |h| + sub = Todo.find_all("done=0 AND context_id=#{h.id}").length + sub + end + total = Todo.find_all("done=0").length - sub end # Returns all the errors on the page for an object... def errors_for( obj ) - error_messages_for( obj ) unless instance_eval("@#{obj}").nil? + error_messages_for( obj ) unless instance_eval("@#{obj}").nil? end end \ No newline at end of file diff --git a/tracks/app/helpers/application_helper.rb b/tracks/app/helpers/application_helper.rb index 7b55b6c3..a3d679d2 100644 --- a/tracks/app/helpers/application_helper.rb +++ b/tracks/app/helpers/application_helper.rb @@ -55,5 +55,24 @@ module ApplicationHelper "" + format_date(due) + " " end end + + # Uses the 'staleness_starts' value from settings.yml (in days) to colour + # the background of the action appropriately according to the age + # of the creation date: + # * l1: created more than 1 x staleness_starts, but < 2 x staleness_starts + # * l2: created more than 2 x staleness_starts, but < 3 x staleness_starts + # * l3: created more than 3 x staleness_starts + # + def staleness(created) + if created < (ApplicationController::STALENESS_STARTS*3).days.ago + return "
" + elsif created < (ApplicationController::STALENESS_STARTS*2).days.ago + return "
" + elsif created < (ApplicationController::STALENESS_STARTS).days.ago + return "
" + else + return "
" + end + end end diff --git a/tracks/app/views/context/_show_items.rhtml b/tracks/app/views/context/_show_items.rhtml index 1fd26c18..7a52d20f 100644 --- a/tracks/app/views/context/_show_items.rhtml +++ b/tracks/app/views/context/_show_items.rhtml @@ -20,7 +20,8 @@ :url => { :controller => "context", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " " %>
-
+ + <%= staleness(item.created) %> <%= due_date( item.due ) %> <%= item.description %> <% if item.project_id %> diff --git a/tracks/app/views/project/_show_items.rhtml b/tracks/app/views/project/_show_items.rhtml index 772e797c..fac643e2 100644 --- a/tracks/app/views/project/_show_items.rhtml +++ b/tracks/app/views/project/_show_items.rhtml @@ -20,7 +20,8 @@ :url => { :controller => "project", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " " %>
-
+ + <%= staleness(item.created) %> <%= due_date( item.due ) %> <%= item.description %> <% if item.context_id %> diff --git a/tracks/app/views/todo/_show_items.rhtml b/tracks/app/views/todo/_show_items.rhtml index c3bbd412..d5424f91 100644 --- a/tracks/app/views/todo/_show_items.rhtml +++ b/tracks/app/views/todo/_show_items.rhtml @@ -20,7 +20,8 @@ :url => { :controller => "todo", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " " %>
-
+ + <%= staleness(item.created) %> <%= due_date( item.due ) %> <%= item.description %> <% if item.project_id %> diff --git a/tracks/config/settings.yml.tmpl b/tracks/config/settings.yml.tmpl index 5f088a2d..48cbf839 100644 --- a/tracks/config/settings.yml.tmpl +++ b/tracks/config/settings.yml.tmpl @@ -2,10 +2,12 @@ # Use two spaces instead of a TAB # 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! # formats: date: %d/%m/%Y week_starts: 1 hp_completed: 5 + staleness_starts: 7 admin: email: butshesagirl@rousette.org.uk diff --git a/tracks/public/stylesheets/standard.css b/tracks/public/stylesheets/standard.css index 301c3db0..b134bd2c 100644 --- a/tracks/public/stylesheets/standard.css +++ b/tracks/public/stylesheets/standard.css @@ -135,12 +135,6 @@ h2 a:hover { } #input_box h2 { - /* background: #CCC; - padding: 5px; - margin: 0px; - margin-left: -15px; - margin-right: -15px; - text-shadow: rgba(0,0,0,.4) 0px 2px 5px; */ color: #999; } @@ -252,6 +246,28 @@ h2 a:hover { font-size: 10px; } +/* Backgrounds marking out 'staleness' of a task based on age of creation date + The colour of the background gets progressively yellower with age */ + +.stale_l1 { + margin-left: 60px; + margin-right: 10px; + background: #ffffCC; + } + +.stale_l2 { + margin-left: 60px; + margin-right: 10px; + background: #ffff66; + } + +.stale_l3 { + margin-left: 60px; + margin-right: 10px; + background: #ffff00; + } + + /* Shows the number of undone next action */ .badge { color: #fff;