fixes #688. After update a newly created context is now shown.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@796 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lrbalt 2008-04-05 14:06:33 +00:00
parent 1cb7592d73
commit 38b99c71bc
2 changed files with 15 additions and 11 deletions

View file

@ -168,6 +168,7 @@ class TodosController < ApplicationController
context.name = params['context_name'].strip
context.save
@new_context_created = true
@not_done_todos = [@todo]
end
params["todo"]["context_id"] = context.id
end

View file

@ -6,7 +6,7 @@ if @saved
status_message = 'Added new context / ' + status_message if @new_context_created
page.notify :notice, status_message, 5.0
#update auto completer arrays for context and project
# update auto completer arrays for context and project
page << "contextAutoCompleter.options.array = #{context_names_for_autocomplete}; contextAutoCompleter.changed = true" if @new_context_created
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true" if @new_project_created
if source_view_is_one_of(:todo, :context)
@ -22,13 +22,16 @@ if @saved
end
if source_view_is(:todo) && @todo.active?
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}"
page.call "todoItems.expandNextActionListingByContext", "c#{@todo.context_id}items", true
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
# show all todos in context
page.insert_html :bottom, "c#{@todo.context_id}items", :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
end
if @new_context_created
page.insert_html :top, 'display_box', :partial => 'contexts/context', :locals => { :context => @todo.context, :collapsible => true }
else
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}"
page.call "todoItems.expandNextActionListingByContext", "c#{@todo.context_id}items", true
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
# show all todos in context
page.insert_html :bottom, "c#{@todo.context_id}items", :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
end
end
# update badge count
page.replace_html("badge_count", @remaining_in_context) if source_view_is :context
page.replace_html("badge_count", @down_count) if source_view_is :todo
@ -88,9 +91,9 @@ if @saved
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
page.visual_effect :highlight, dom_id(@todo), :duration => 3
end
elsif source_view_is :stats
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
page.visual_effect :highlight, dom_id(@todo), :duration => 3
elsif source_view_is :stats
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
page.visual_effect :highlight, dom_id(@todo), :duration => 3
else
logger.error "unexpected source_view '#{params[:_source_view]}'"
end