From f5162ed8daf33debd25118a82e01470995bb9f0b Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Fri, 26 Jun 2009 16:53:24 +0200 Subject: [PATCH] deleting a recurring todo, the next todo was not placed in the ticker. This patch fixes #909 --- app/views/todos/destroy.js.rjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/todos/destroy.js.rjs b/app/views/todos/destroy.js.rjs index ac1ba3d4..f54124ff 100644 --- a/app/views/todos/destroy.js.rjs +++ b/app/views/todos/destroy.js.rjs @@ -11,13 +11,15 @@ if @saved page['tickler-empty-nd'].show if source_view_is(:deferred) && @down_count == 0 # show new todo if the completed todo was recurring - unless @new_recurring_todo.nil? + unless @new_recurring_todo.nil? || @new_recurring_todo.deferred? page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id(@new_recurring_todo) page.insert_html :bottom, item_container_id(@new_recurring_todo), :partial => 'todos/todo', :locals => { :todo => @new_recurring_todo, :parent_container_type => parent_container_type } page.visual_effect :highlight, dom_id(@new_recurring_todo, 'line'), {'startcolor' => "'#99ff99'"} page.notify :notice, "Action was deleted. Because this action is recurring, a new action was added", 6.0 else - page.notify :notice, "There is no next action after the recurring action you just deleted. The recurrence is completed", 6.0 unless @recurring_todo.nil? + if @todo.recurring_todo.todos.active.count == 0 + page.notify :notice, "There is no next action after the recurring action you just deleted. The recurrence is completed", 6.0 unless @recurring_todo.nil? + end end else page.notify :error, "There was an error deleting the item #{@todo.description}", 8.0