Fix bug where editing the project of a todo from project view would not remove the todo from that project

This commit is contained in:
Reinier Balt 2011-03-09 12:13:49 +01:00
parent 8e0b1e4c2d
commit 90d3211a4d
2 changed files with 6 additions and 5 deletions

View file

@ -898,9 +898,10 @@ class TodosController < ApplicationController
@remaining_hidden_count = current_user.todos.hidden.with_tag(tag).count
}
from.project {
@remaining_deferred_or_pending_count = current_user.projects.find(@todo.project_id).todos.deferred_or_blocked.count
@remaining_in_context = current_user.projects.find(@todo.project_id).todos.active.count
@target_context_count = current_user.projects.find(@todo.project_id).todos.active.count
project_id = @project_changed ? @original_item_project_id : @todo.project_id
@remaining_deferred_or_pending_count = current_user.projects.find(project_id).todos.deferred_or_blocked.count
@remaining_in_context = current_user.projects.find(project_id).todos.active.count
@target_context_count = current_user.projects.find(project_id).todos.active.count
}
from.calendar {
@target_context_count = @new_due_id.blank? ? 0 : count_old_due_empty(@new_due_id)

View file

@ -303,7 +303,7 @@ module TodosHelper
def update_needs_to_remove_todo_from_container
source_view do |page|
page.context { return @context_changed || @todo.deferred? || @todo.pending? }
page.project { return @todo_deferred_state_changed || @todo_pending_state_changed }
page.project { return @todo_deferred_state_changed || @todo_pending_state_changed || @project_changed}
page.deferred { return @context_changed || !(@todo.deferred? || @todo.pending?) }
page.calendar { return @due_date_changed || !@todo.due }
page.stats { return @todo.completed? }
@ -378,7 +378,7 @@ module TodosHelper
container_id = "tickler-empty-nd" if (
( (@todo_was_activated_from_deferred_state || @todo_was_activated_from_pending_state) && @remaining_deferred_or_pending_count == 0) ||
(@original_item_was_deferred && @remaining_deferred_or_pending_count == 0 && @todo.completed?) )
container_id = "empty-d" if @completed_count && @completed_count == 0 && !@todo.completed?
container_id = "empty-d" if @completed_count && @completed_count == 0 && !@todo.completed?
}
page.deferred { container_id = "c#{@original_item_context_id}empty-nd" if @remaining_in_context == 0 }
page.calendar { container_id = "empty_#{@original_item_due_id}" if @old_due_empty }