From a02b2cc1849e54ae9946431a4cb9e7613f958671 Mon Sep 17 00:00:00 2001 From: Henrik Bohre Date: Thu, 21 May 2009 01:55:53 +0200 Subject: [PATCH] #300: Home view working when completing/undoing todos Updated toggle_check.js.rjs to handle DOM manipulation for the Home page. --- app/views/todos/toggle_check.js.rjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/todos/toggle_check.js.rjs b/app/views/todos/toggle_check.js.rjs index 92289b16..68a6a89a 100644 --- a/app/views/todos/toggle_check.js.rjs +++ b/app/views/todos/toggle_check.js.rjs @@ -14,7 +14,7 @@ if @saved # Activate pending todos that are successors of the completed @pending_to_activate.each do |t| logger.debug "#300: Removing #{t.description} from pending block and adding it to active" - page[t].remove + page[t].remove if source_view_is(:project) # Remove todo from pending block (if it exists) page.insert_html :bottom, item_container_id(t), :partial => 'todos/todo', :locals => { :todo => t, :parent_container_type => parent_container_type } end @@ -54,9 +54,10 @@ if @saved @active_to_block.each do |t| logger.debug "#300: Block #{t.description} that are a successor of #{@todo.description}" page[t].remove # Remove it from active - # Insert it in deferred/pending block - logger.debug "Insert #{t.description} in deferred/pending block" - page.insert_html :bottom, item_container_id(t), :partial => 'todos/todo', :locals => { :todo => t, :parent_container_type => parent_container_type } + if source_view_is(:project) # Insert it in deferred/pending block if existing + logger.debug "Insert #{t.description} in deferred/pending block" + page.insert_html :bottom, item_container_id(t), :partial => 'todos/todo', :locals => { :todo => t, :parent_container_type => parent_container_type } + end end end