mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-02 22:11:48 +01:00
Fixes ticket #8.
There's a new setting in settings.yml (staleness_starts) which defines the number of days before which actions get marked as stale. Let's say you set it to 7 days. Actions created between 7 and 14 days ago get marked pale yellow, those created between 14 and 28 days ago (staleness_starts * 2) get marked darker yellow, and those created more than 28 days ago (staleness_starts * 3) are fluorescent yellow! If you see fluorescent yellow, you should '''really''' get down to doing that action. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@89 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
f772114c66
commit
c6ec129570
7 changed files with 59 additions and 18 deletions
|
|
@ -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
|
||||
|
|
@ -55,5 +55,24 @@ module ApplicationHelper
|
|||
"<span class=\"green\">" + format_date(due) + "</span> "
|
||||
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 "<div class=\"stale_l3\">"
|
||||
elsif created < (ApplicationController::STALENESS_STARTS*2).days.ago
|
||||
return "<div class=\"stale_l2\">"
|
||||
elsif created < (ApplicationController::STALENESS_STARTS).days.ago
|
||||
return "<div class=\"stale_l1\">"
|
||||
else
|
||||
return "<div class=\"description\">"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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}\'?" ) + " "
|
||||
%>
|
||||
</div>
|
||||
<div class="description">
|
||||
<!-- start of div which has a class 'description' or 'stale_7d', 'stale_14d' etc -->
|
||||
<%= staleness(item.created) %>
|
||||
<%= due_date( item.due ) %>
|
||||
<%= item.description %>
|
||||
<% if item.project_id %>
|
||||
|
|
|
|||
|
|
@ -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}\'?" ) + " "
|
||||
%>
|
||||
</div>
|
||||
<div class="description">
|
||||
<!-- start of div which has a class 'description' or 'stale_7d', 'stale_14d' etc -->
|
||||
<%= staleness(item.created) %>
|
||||
<%= due_date( item.due ) %>
|
||||
<%= item.description %>
|
||||
<% if item.context_id %>
|
||||
|
|
|
|||
|
|
@ -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}\'?" ) + " "
|
||||
%>
|
||||
</div>
|
||||
<div class="description">
|
||||
<!-- start of div which has a class 'description' or 'stale_7d', 'stale_14d' etc -->
|
||||
<%= staleness(item.created) %>
|
||||
<%= due_date( item.due ) %>
|
||||
<%= item.description %>
|
||||
<% if item.project_id %>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue