[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]

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@57 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2005-04-03 11:45:05 +00:00
parent 8fba2bebc6
commit 0577e850f6
8 changed files with 13 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -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)