From 6126a6e9d70932cad03d09285d5e2f2b36d95d10 Mon Sep 17 00:00:00 2001 From: Eric Allen Date: Wed, 7 Oct 2009 11:54:42 -0400 Subject: [PATCH] Todo check/uncheck handles contexts properly --- app/views/todos/toggle_check.js.rjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/todos/toggle_check.js.rjs b/app/views/todos/toggle_check.js.rjs index d3ea0e3f..c491172c 100644 --- a/app/views/todos/toggle_check.js.rjs +++ b/app/views/todos/toggle_check.js.rjs @@ -14,7 +14,7 @@ if @saved # remove container if empty if @remaining_in_context == 0 && source_view_is(:todo) - page.visual_effect :fade, item_container_id(@todo), :duration => 0.4 + page.visual_effect :fade, "c"+@todo.context.id.to_s, :duration => 0.4 end if @original_item_was_deferred && source_view_is(:tag) @@ -42,6 +42,7 @@ if @saved page.insert_html :bottom, item_container_id(@todo), :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type } page.visual_effect :highlight, dom_id(@todo, 'line'), {'startcolor' => "'#99ff99'"} page.show "empty-d" if @completed_count == 0 + page.show "c"+@todo.context.id.to_s page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? # If we've checked something as undone, incomplete items can't be empty end @@ -54,4 +55,4 @@ else page.replace_html "status", content_tag("div", content_tag("h2", "#{pluralize(@todo.errors.count, "error")} prohibited this action from being saved") + content_tag("p", "There were problems with the following fields:") + content_tag("ul", @todo.errors.each_full { |msg| content_tag("li", msg) }), "id" => "errorExplanation", "class" => "errorExplanation") end # make sure the behavior of the new/updated todo is enabled -page << "TodoBehavior.enableToggleNotes()" \ No newline at end of file +page << "TodoBehavior.enableToggleNotes()"