Added caching properly this time. Caches todo/list page quite well, then list action of context and projects controllers.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@32 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2005-02-27 12:27:35 +00:00
parent 7776931d69
commit 49b2ad4dc7
8 changed files with 24 additions and 11 deletions

View file

@ -4,7 +4,7 @@ class TodoController < ApplicationController
model :context, :project
before_filter :login_required
# caches_action :list, :completed
caches_action :list, :completed, :completed_archive
layout "standard"
# Main method for listing tasks
@ -54,6 +54,7 @@ class TodoController < ApplicationController
# Parameters from form fields should be passed to create new item
#
def add_item
expire_action(:controller => "todo", :action => "list")
@item = Todo.new
@item.attributes = @params["item"]
@ -68,6 +69,7 @@ class TodoController < ApplicationController
def edit
expire_action(:controller => "todo", :action => "list")
@item = Todo.find(@params['id'])
@belongs = @item.project_id
@projects = Project.find_all
@ -77,6 +79,7 @@ class TodoController < ApplicationController
def update
expire_action(:controller => "todo", :action => "list")
@item = Todo.find(@params['item']['id'])
@item.attributes = @params['item']
if @item.save
@ -90,6 +93,7 @@ class TodoController < ApplicationController
def destroy
expire_action(:controller => "todo", :action => "list")
item = Todo.find(@params['id'])
if item.destroy
flash["confirmation"] = "Next action was successfully deleted"
@ -103,6 +107,9 @@ class TodoController < ApplicationController
# Toggles the 'done' status of the action
#
def toggle_check
expire_action(:controller => "todo", :action => "list")
expire_action(:controller => "todo", :action => "completed")
expire_action(:controller => "todo", :action => "completed_archive")
item = Todo.find(@params['id'])
item.toggle!('done')