tracks/app/views/todos/destroy.js.rjs
Eric Allen 9fa5ead8de Fixed another edge case that Luis caught
Thanks for testing!
2009-12-01 23:39:07 -05:00

36 lines
2 KiB
Text

if @saved
page[@todo].remove
page.show "empty_"+@original_item_due_id if @old_due_empty
page['badge_count'].replace_html @down_count
# remove context if empty
page.visual_effect(:fade, "c#{@todo.context_id}", :duration => 0.4) if (@remaining_in_context == 0)
# show message if there are no actions
page[empty_container_msg_div_id].show if !empty_container_msg_div_id.nil? && @down_count == 0
page['tickler-empty-nd'].show if source_view_is(:deferred) && @down_count == 0
# show new todo if the completed todo was recurring
if @todo.from_recurring_todo?
unless @new_recurring_todo.nil? || @new_recurring_todo.deferred?
page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id(@new_recurring_todo)
page.insert_html :bottom, item_container_id(@new_recurring_todo), :partial => 'todos/todo', :locals => { :todo => @new_recurring_todo, :parent_container_type => parent_container_type }
page.visual_effect :highlight, dom_id(@new_recurring_todo, 'line'), {'startcolor' => "'#99ff99'"}
page.notify :notice, "Action was deleted. Because this action is recurring, a new action was added", 6.0
else
if @todo.recurring_todo.todos.active.count == 0
page.notify :notice, "There is no next action after the recurring action you just deleted. The recurrence is completed", 6.0 if @new_recurring_todo.nil?
end
end
end
# Activate pending todos that are successors of the deleted
@pending_to_activate.each do |t|
logger.debug "#300: Removing #{t.description} from pending block and adding it to active"
page[t].remove if source_view_is(:project) or source_view_is(:tag)
page.insert_html :bottom, item_container_id(t), :partial => 'todos/todo', :locals => { :todo => t, :parent_container_type => parent_container_type }
page.visual_effect :highlight, dom_id(t, 'line'), {'startcolor' => "'#99ff99'", :duration => 2}
end
else
page.notify :error, "There was an error deleting the item #{@todo.description}", 8.0
end