diff --git a/tracks/app/controllers/todos_controller.rb b/tracks/app/controllers/todos_controller.rb index 1ee5af5c..cada71bd 100644 --- a/tracks/app/controllers/todos_controller.rb +++ b/tracks/app/controllers/todos_controller.rb @@ -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 diff --git a/tracks/app/views/todos/update.rjs b/tracks/app/views/todos/update.rjs index fa0bbf0d..5a3f8b69 100644 --- a/tracks/app/views/todos/update.rjs +++ b/tracks/app/views/todos/update.rjs @@ -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