From 3f90096bb8adae2b3275bc2272f0a60ae45bf3ee Mon Sep 17 00:00:00 2001 From: bsag Date: Sun, 12 Jun 2005 12:14:30 +0000 Subject: [PATCH] Completed projects no longer appear in the Projects drop down on all the forms. Fixes #66. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@105 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/controllers/context_controller.rb | 8 ++++---- tracks/app/controllers/project_controller.rb | 10 +++++----- tracks/app/controllers/todo_controller.rb | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index cfb0591d..382b2c3a 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -26,7 +26,7 @@ class ContextController < ApplicationController def show @context = Context.find_by_name(deurlize(@params["name"])) @places = Context.find(:all, :order => "position ASC") - @projects = Project.find(:all, :order => "position ASC") + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) @page_title = "TRACKS::Context: #{@context.name}" @not_done = Todo.find(:all, :conditions => "done=0 AND context_id=#{@context.id}", :order => "due IS NULL, due ASC, created ASC") @@ -64,7 +64,7 @@ class ContextController < ApplicationController # def update_action @places = Context.find(:all, :order => "position ASC") - @projects = Project.find(:all, :order => "position ASC") + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) action = Todo.find(params[:id]) action.attributes = @params["item"] if action.due? @@ -85,7 +85,7 @@ class ContextController < ApplicationController # Parameters from form fields are passed to create new action # def add_item - @projects = Project.find( :all, :order => "position ASC" ) + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) @places = Context.find( :all, :order => "position ASC" ) item = Todo.new @@ -134,7 +134,7 @@ class ContextController < ApplicationController # def toggle_check @places = Context.find(:all, :order => "position ASC") - @projects = Project.find(:all, :order => "position ASC") + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) item = Todo.find(params[:id]) diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index 8e4d8dcf..c0e9848a 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -17,7 +17,7 @@ class ProjectController < ApplicationController # def list @page_title = "TRACKS::List Projects" - @projects = Project.find(:all, :conditions => nil, :order => "position ASC") + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) end # Filter the projects to show just the one passed in the URL @@ -26,7 +26,7 @@ class ProjectController < ApplicationController def show @project = Project.find_by_name(deurlize(@params["name"])) @places = Context.find(:all, :order => "position ASC") - @projects = Project.find(:all, :order => "position ASC") + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) @page_title = "TRACKS::Project: #{@project.name}" @not_done = Todo.find(:all, :conditions => "done=0 AND project_id=#{@project.id}", :order => "due IS NULL, due ASC, created ASC") @@ -62,7 +62,7 @@ class ProjectController < ApplicationController # def update_action @places = Context.find(:all, :order => "position ASC") - @projects = Project.find(:all, :order => "position ASC") + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) action = Todo.find(params[:id]) action.attributes = @params["item"] @@ -84,7 +84,7 @@ class ProjectController < ApplicationController # Parameters from form fields are passed to create new action # def add_item - @projects = Project.find( :all, :order => "position ASC" ) + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) @places = Context.find( :all, :order => "position ASC" ) item = Todo.new @@ -134,7 +134,7 @@ class ProjectController < ApplicationController # def toggle_check @places = Context.find(:all, :order => "position ASC") - @projects = Project.find(:all, :order => "position ASC") + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) item = Todo.find(@params['id']) item.toggle!('done') diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index d95c13a7..54ab166b 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -17,7 +17,7 @@ class TodoController < ApplicationController # def list @page_title = "TRACKS::List tasks" - @projects = Project.find( :all, :order => "position ASC" ) + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) @places = Context.find( :all, :order => "position ASC" ) @shown_places = Context.find( :all, :conditions => "hide=0", :order => "position ASC" ) @hidden_places = Context.find( :all, :conditions => "hide=1", :order => "position ASC" ) @@ -71,7 +71,7 @@ class TodoController < ApplicationController # Parameters from form fields are passed to create new action # in the selected context. def add_item - @projects = Project.find( :all, :order => "position ASC" ) + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) @places = Context.find( :all, :order => "position ASC" ) item = Todo.new @@ -95,7 +95,7 @@ class TodoController < ApplicationController # def update_action @places = Context.find(:all, :order => "position ASC") - @projects = Project.find(:all, :order => "position ASC") + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) action = Todo.find(params[:id]) action.attributes = @params["item"] if action.due? @@ -127,7 +127,7 @@ class TodoController < ApplicationController # Toggles the 'done' status of the action # def toggle_check - @projects = Project.find(:all, :order => "position ASC") + @projects = Project.find( :all, :conditions => "done=0", :order => "position ASC" ) @places = Context.find(:all, :order => "position ASC") item = Todo.find(@params['id'])