[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) @context = Context.find_by_name(@params["id"].humanize)
@projects = Project.find_all @projects = Project.find_all
@page_title = "TRACKS::Context: #{@context.name.capitalize}" @page_title = "TRACKS::Context: #{@context.name.capitalize}"
@not_done = Todo.find_all( "context_id=#{@context.id} AND done=0", "created ASC" ) @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" ) @count = Todo.count( "context_id=#{@context.id} AND done=0" )
end end

View file

@ -29,7 +29,7 @@ class ProjectController < ApplicationController
@project = Project.find_by_name(@params["name"].humanize) @project = Project.find_by_name(@params["name"].humanize)
@places = Context.find_all @places = Context.find_all
@page_title = "TRACKS::Project: #{@project.name}" @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" ) @count = Todo.count( "project_id=#{@project.id} AND done=0" )
end end

View file

@ -9,6 +9,7 @@ class TodoController < ApplicationController
# Main method for listing tasks # Main method for listing tasks
# Set page title, and fill variables with contexts and done and not-done 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 def index
@ -18,11 +19,12 @@ class TodoController < ApplicationController
def list def list
@page_title = "TRACKS::List tasks" @page_title = "TRACKS::List tasks"
@no_of_actions = app_configurations["formats"]["hp_completed"]
@projects = Project.find_all @projects = Project.find_all
@places = Context.find_all @places = Context.find_all
@shown_places = Context.find_all_by_hide( "0", "position ASC") @shown_places = Context.find_all_by_hide( "0", "position ASC")
@hidden_places = Context.find_all_by_hide( "1", "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 # Set count badge to number of not-done, not hidden context items
@count = count_shown_items(@hidden_places) @count = count_shown_items(@hidden_places)

View file

@ -13,7 +13,7 @@
<td valign="top"><%= due_date( @item.due ) %> <td valign="top"><%= due_date( @item.due ) %>
<%= @item.description %> <%= @item.description %>
<% if @item.project_id %> <% 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 %> <% end %>
<% if @item.notes? %> <% if @item.notes? %>
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + <%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" +

View file

@ -15,7 +15,7 @@
<td valign="top"><%= due_date( @item.due ) %> <td valign="top"><%= due_date( @item.due ) %>
<%= @item.description %> <%= @item.description %>
<% if @item.project_id %> <% 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 %> <% end %>
<% if @item.notes? %> <% if @item.notes? %>
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>" %> <%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>" %>

View file

@ -1,6 +1,6 @@
<div id="display_box"> <div id="display_box">
<% for @shown_place in @shown_places %> <% 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? %> <% if !@not_done.empty? %>
<div class="contexts"> <div class="contexts">
<h2> <h2>
@ -23,7 +23,7 @@
</div> </div>
<div class="contexts"> <div class="contexts">
<h2>Last 5 completed actions</h2> <h2>Last <%= @no_of_actions %> completed actions</h2>
<table class="next_actions" id="complete" cellspacing="5" cellpadding="0" border="0"> <table class="next_actions" id="complete" cellspacing="5" cellpadding="0" border="0">
<%= render_collection_of_partials "done", @done %> <%= render_collection_of_partials "done", @done %>

View file

@ -1,4 +1,5 @@
formats: formats:
date: %d/%m/%Y date: %d/%m/%Y
hp_completed: 5
admin: admin:
email: butshesagirl@rousette.org.uk email: butshesagirl@rousette.org.uk

View file

@ -3,7 +3,7 @@
## $HeadURL$ ## $HeadURL$
# Homepage:: http://www.rousette.org.uk/projects/ # Homepage:: http://www.rousette.org.uk/projects/
# Author:: bsag (http://www.rousette.org.uk/) # Author:: bsag (http://www.rousette.org.uk/)
# Contributors:: Lolindrath, Jim Ray, Nicholas Lee # Contributors:: Lolindrath, Jim Ray, Nicholas Lee, Arnaud Limbourg
# Version:: 1.02 # Version:: 1.02
# Copyright:: (cc) 2004-2005 rousette.org.uk # Copyright:: (cc) 2004-2005 rousette.org.uk
# License:: GNU GPL # License:: GNU GPL
@ -22,6 +22,7 @@ Project wiki: <http://www.rousette.org.uk/projects/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. 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 <http://www.pxl8.com/calendar_date_picker.html>. It works well, but I need to make sure it doesn't break in postgresql or sqlite. 8. I added a pop-up calendar to set the due date. This is entirely lifted from Michele's excellent tutorial on pxl8.com <http://www.pxl8.com/calendar_date_picker.html>. 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. 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 ## Version 1.02