diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index c472d40e..73fd0e00 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -422,6 +422,12 @@ class TodosController < ApplicationController @projects = current_user.projects @contexts = current_user.contexts @contexts_to_show = @contexts.reject {|x| x.hide? } + + # Set defaults for new_action + @initial_tag_name = @tag_name + unless @not_done_todos.empty? + @context = current_user.contexts.find_by_id(@not_done_todos[0].context_id) + end # Set count badge to number of items with this tag @not_done_todos.empty? ? @count = 0 : @count = @not_done_todos.size diff --git a/app/views/shared/_add_new_item_form.rhtml b/app/views/shared/_add_new_item_form.rhtml index 66458200..4c0c5a2f 100644 --- a/app/views/shared/_add_new_item_form.rhtml +++ b/app/views/shared/_add_new_item_form.rhtml @@ -44,7 +44,7 @@
- <%= text_field_tag "tag_list", nil, :size => 30, :tabindex => 5 %> + <%= text_field_tag "tag_list", @initial_tag_name, :size => 30, :tabindex => 5 %> <%= content_tag("div", "", :id => "tag_list_auto_complete", :class => "auto_complete") %> <%= auto_complete_field 'tag_list', { :url => {:controller => 'todos', :action => 'auto_complete_for_tag'}, @@ -135,4 +135,4 @@ <%= calendar_setup( "todo_due" ) %> <%= calendar_setup( "todo_show_from" ) %> - \ No newline at end of file +