Fix the Ajax corner case described in #353 : "change of todo's context on home page should work like marking complete"

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@316 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2006-08-25 03:57:26 +00:00
parent c0b0e14b9e
commit dc73835c7b
2 changed files with 8 additions and 0 deletions

View file

@ -133,6 +133,7 @@ class TodoController < ApplicationController
params["item"]["due"] = ""
end
@saved = @item.update_attributes params["item"]
@remaining_undone_in_original_context = Todo.count(:conditions => ['user_id = ? and context_id = ? and type = ? and done = ?', @user.id, @original_item_context_id, "Immediate", false])
end
def update_context

View file

@ -7,6 +7,13 @@ if @saved
page.visual_effect :highlight, item_container_id, :duration => 3
else
page[item_container_id].remove
if (@remaining_undone_in_original_context == 0)
source_view do |from|
from.todo { page.visual_effect :fade, "c#{@original_item_context_id}", :duration => 0.4 }
from.context { page.show "c#{@original_item_context_id}empty-nd" }
end
end
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@item.context_id}"
page.call "todoItems.expandNextActionListingByContext", "c#{@item.context_id}items", true
page.insert_html :bottom, "c#{@item.context_id}items", :partial => 'todo/item', :locals => { :parent_container_type => "context" }
page.delay(0.5) do