diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb
index 1d82b8d4..b83783fb 100644
--- a/tracks/app/controllers/context_controller.rb
+++ b/tracks/app/controllers/context_controller.rb
@@ -81,8 +81,8 @@ class ContextController < ApplicationController
@context = Context.find_by_name(@params["id"].humanize)
@projects = Project.find_all
@page_title = "TRACKS::Context: #{@context.name.capitalize}"
- @not_done = Todo.find_all( "context_id=#{@context.id} AND done=0", "created ASC" )
- @count = Todo.count( "context_id=#{@context.id} AND done=0" )
+ @not_done = Todo.find_all( "context_id=#{@context.id} AND done=0", "due DESC, created ASC" )
+ @count = Todo.count( "context_id=#{@context.id} AND done=0" )
end
diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb
index 6d14119c..787595f8 100644
--- a/tracks/app/controllers/project_controller.rb
+++ b/tracks/app/controllers/project_controller.rb
@@ -29,7 +29,7 @@ class ProjectController < ApplicationController
@project = Project.find_by_name(@params["name"].humanize)
@places = Context.find_all
@page_title = "TRACKS::Project: #{@project.name}"
- @not_done = Todo.find_all( "project_id=#{@project.id} AND done=0", "created DESC" )
+ @not_done = Todo.find_all( "project_id=#{@project.id} AND done=0", "due DESC, created ASC" )
@count = Todo.count( "project_id=#{@project.id} AND done=0" )
end
diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb
index 1a063916..4ca41a85 100644
--- a/tracks/app/controllers/todo_controller.rb
+++ b/tracks/app/controllers/todo_controller.rb
@@ -9,6 +9,7 @@ class TodoController < ApplicationController
# Main method for listing tasks
# Set page title, and fill variables with contexts and done and not-done tasks
+ # Number of completed actions to show is determined by a setting in settings.yml
#
def index
@@ -18,11 +19,12 @@ class TodoController < ApplicationController
def list
@page_title = "TRACKS::List tasks"
+ @no_of_actions = app_configurations["formats"]["hp_completed"]
@projects = Project.find_all
@places = Context.find_all
@shown_places = Context.find_all_by_hide( "0", "position ASC")
@hidden_places = Context.find_all_by_hide( "1", "position ASC" )
- @done = Todo.find_all_by_done( 1, "completed DESC", 5 )
+ @done = Todo.find_all_by_done( 1, "completed DESC", @no_of_actions )
# Set count badge to number of not-done, not hidden context items
@count = count_shown_items(@hidden_places)
diff --git a/tracks/app/views/context/_not_done.rhtml b/tracks/app/views/context/_not_done.rhtml
index 399c1597..48624973 100644
--- a/tracks/app/views/context/_not_done.rhtml
+++ b/tracks/app/views/context/_not_done.rhtml
@@ -13,7 +13,7 @@
<%= due_date( @item.due ) %>
<%= @item.description %>
<% if @item.project_id %>
- <%= link_to( "[P]", { :controller => "project", :action => "show", :id => @item.project_id }, :title => "View project: #{@item.project['name']}" ) %>
+ <%= link_to( "[P]", { :controller => "project", :action => "show", :name => urlize(@item.project.name) }, :title => "View project: #{@item.project.name}" ) %>
<% end %>
<% if @item.notes? %>
<%= "" +
diff --git a/tracks/app/views/project/_not_done.rhtml b/tracks/app/views/project/_not_done.rhtml
index e98ce4e7..2c8a8d41 100644
--- a/tracks/app/views/project/_not_done.rhtml
+++ b/tracks/app/views/project/_not_done.rhtml
@@ -15,7 +15,7 @@
| <%= due_date( @item.due ) %>
<%= @item.description %>
<% if @item.project_id %>
- <%= link_to( "[C]", { :controller => "context", :action => "show", :id => @item.context_id }, :title => "View context: #{@item.context['name'].capitalize}" ) %>
+ <%= link_to( "[C]", { :controller => "context", :action => "show", :name => urlize(@item.context.name) }, :title => "View context: #{@item.context.name.capitalize}" ) %>
<% end %>
<% if @item.notes? %>
<%= "" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "" %>
diff --git a/tracks/app/views/todo/list.rhtml b/tracks/app/views/todo/list.rhtml
index 72a54b43..3ddb71c8 100644
--- a/tracks/app/views/todo/list.rhtml
+++ b/tracks/app/views/todo/list.rhtml
@@ -1,6 +1,6 @@
<% for @shown_place in @shown_places %>
- <% @not_done = Todo.find_all("done=0 AND context_id=#{@shown_place.id}", "created ASC") %>
+ <% @not_done = Todo.find_all("done=0 AND context_id=#{@shown_place.id}", "due DESC, created ASC") %>
<% if !@not_done.empty? %>
@@ -23,7 +23,7 @@
- Last 5 completed actions
+ Last <%= @no_of_actions %> completed actions
<%= render_collection_of_partials "done", @done %>
diff --git a/tracks/config/settings.yml.tmpl b/tracks/config/settings.yml.tmpl
index e3b8d406..9cc89fda 100644
--- a/tracks/config/settings.yml.tmpl
+++ b/tracks/config/settings.yml.tmpl
@@ -1,4 +1,5 @@
formats:
date: %d/%m/%Y
+ hp_completed: 5
admin:
email: butshesagirl@rousette.org.uk
diff --git a/tracks/doc/CHANGENOTES.txt b/tracks/doc/CHANGENOTES.txt
index 51563322..40888730 100644
--- a/tracks/doc/CHANGENOTES.txt
+++ b/tracks/doc/CHANGENOTES.txt
@@ -3,7 +3,7 @@
## $HeadURL$
# Homepage:: http://www.rousette.org.uk/projects/
# Author:: bsag (http://www.rousette.org.uk/)
-# Contributors:: Lolindrath, Jim Ray, Nicholas Lee
+# Contributors:: Lolindrath, Jim Ray, Nicholas Lee, Arnaud Limbourg
# Version:: 1.02
# Copyright:: (cc) 2004-2005 rousette.org.uk
# License:: GNU GPL
@@ -22,6 +22,7 @@ Project wiki:
7. [Contributed by Jim Ray] Jim added a host of fixes and bits of cleaning up, including a position column for contexts and projects to allow custom sorting, and changes to the links for pages to make them more human-readable.
8. I added a pop-up calendar to set the due date. This is entirely lifted from Michele's excellent tutorial on pxl8.com . It works well, but I need to make sure it doesn't break in postgresql or sqlite.
9. [Contributed by Nicholas Lee] Changes to the way that URLs are specified which should improve the situation for people using Tracks in a subdirectory.
+10. [Contributed by Arnaud Limbourg, ticket:18] A new entry in settings.yml allows you to choose the number of completed actions you want to see on the /todo/list home page. Also sorts by due date (ascending) first, then creation date (descending) on /todo/list, /context/show/[name], and /project/show/[name]
## Version 1.02
|