From 136727fb3f1f25af390edb32d563538a33a164ef Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Tue, 14 Apr 2009 21:36:57 +0200 Subject: [PATCH] fix #875. Make sure that in tag view when you mark the last deferred todo complete, the empty-message appears --- app/controllers/todos_controller.rb | 2 ++ app/views/todos/toggle_check.js.rjs | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index d25a6da3..12b2dbd4 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -132,6 +132,7 @@ class TodosController < ApplicationController def toggle_check @source_view = params['_source_view'] || 'todo' @original_item_due = @todo.due + @original_item_was_deferred = @todo.deferred? @saved = @todo.toggle_completion! # check if this todo has a related recurring_todo. If so, create next todo @@ -143,6 +144,7 @@ class TodosController < ApplicationController determine_remaining_in_context_count(@todo.context_id) determine_down_count determine_completed_count if @todo.completed? + determine_deferred_tag_count(params['_tag_name']) if @source_view == 'tag' if source_view_is :calendar @original_item_due_id = get_due_id_for_calendar(@original_item_due) @old_due_empty = is_old_due_empty(@original_item_due_id) diff --git a/app/views/todos/toggle_check.js.rjs b/app/views/todos/toggle_check.js.rjs index c1757628..d3ea0e3f 100644 --- a/app/views/todos/toggle_check.js.rjs +++ b/app/views/todos/toggle_check.js.rjs @@ -16,7 +16,13 @@ if @saved if @remaining_in_context == 0 && source_view_is(:todo) page.visual_effect :fade, item_container_id(@todo), :duration => 0.4 end - + + if @original_item_was_deferred && source_view_is(:tag) + # we go from the deferred container to the completed container in tag view + # check for empty message + page['tickler-empty-nd'].show if @deferred_tag_count == 0 + end + # show new todo if the completed todo was recurring if @todo.from_recurring_todo? unless @new_recurring_todo.nil? || @new_recurring_todo.deferred?