mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-03 22:41:48 +01:00
When a "next action" is edited from a project page and the edit changes the project, the "next action" now disappears from the page as it should. Fixes #392
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@326 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
c89a8249ed
commit
fa4b1c4c7b
2 changed files with 12 additions and 3 deletions
|
|
@ -113,7 +113,7 @@ class TodoController < ApplicationController
|
|||
@saved = @item.save
|
||||
@remaining_undone_in_context = Todo.count(:conditions => ['user_id = ? and context_id = ? and type = ? and done = ?', @user.id, @item.context_id, "Immediate", false])
|
||||
if @saved
|
||||
@down_count = @todos.collect { |x| ( !x.done? and !x.context.hide? ) ? x:nil }.compact.size.to_s
|
||||
@down_count = @todos.reject { |x| x.done? || x.context.hide? }.size.to_s
|
||||
end
|
||||
return if request.xhr?
|
||||
|
||||
|
|
@ -128,6 +128,7 @@ class TodoController < ApplicationController
|
|||
init
|
||||
@item = check_user_return_item
|
||||
@original_item_context_id = @item.context_id
|
||||
@original_item_project_id = @item.project_id
|
||||
@item.attributes = params["item"]
|
||||
if params["item"].has_key?("due")
|
||||
params["item"]["due"] = parse_date_per_user_prefs(params["item"]["due"])
|
||||
|
|
@ -136,6 +137,7 @@ class TodoController < ApplicationController
|
|||
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])
|
||||
@remaining_undone_in_original_project = Todo.count(:conditions => ['user_id = ? and project_id = ? and type = ? and done = ?', @user.id, @original_item_project_id, "Immediate", false])
|
||||
end
|
||||
|
||||
def update_context
|
||||
|
|
|
|||
|
|
@ -23,8 +23,15 @@ if @saved
|
|||
end
|
||||
end
|
||||
elsif source_view_is :project
|
||||
page.replace item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => "project" }
|
||||
page.visual_effect :highlight, item_container_id, :duration => 3
|
||||
if @item.project_id == @original_item_project_id
|
||||
page.replace item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => "project" }
|
||||
page.visual_effect :highlight, item_container_id, :duration => 3
|
||||
else
|
||||
page[item_container_id].remove
|
||||
if (@remaining_undone_in_original_project == 0)
|
||||
page.show "p#{@original_item_project_id}empty-nd"
|
||||
end
|
||||
end
|
||||
else
|
||||
logger.error "unexpected source_view '#{params[:_source_view]}'"
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue