diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index 793b753c..2bdb06c5 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -18,8 +18,8 @@ class TodosController < ApplicationController extend ActionView::Helpers::SanitizeHelper::ClassMethods def index - @projects = current_user.projects.find(:all, :include => [:default_context]) - @contexts = current_user.contexts.find(:all) + @projects = current_user.projects.all(:include => [:default_context]) + @contexts = current_user.contexts @contexts_to_show = current_user.contexts.active diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index eb31f8e7..3f616b86 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -1,4 +1,5 @@ module TodosHelper + def remote_star_icon(todo=@todo) link_to( image_tag_for_star(todo), @@ -272,7 +273,7 @@ module TodosHelper end def default_contexts_for_autocomplete - projects = current_user.uncompleted.projects.find(:all, :include => [:context], :conditions => ['default_context_id is not null']) + projects = current_user.projects.uncompleted.find(:all, :include => [:default_context], :conditions => ['NOT(default_context_id IS NULL)']) Hash[*projects.map{ |p| [escape_javascript(p.name), escape_javascript(p.default_context.name)] }.flatten].to_json end diff --git a/app/views/shared/_add_new_item_form.rhtml b/app/views/shared/_add_new_item_form.rhtml index 940dedb5..d8e3b9a7 100644 --- a/app/views/shared/_add_new_item_form.rhtml +++ b/app/views/shared/_add_new_item_form.rhtml @@ -1,6 +1,7 @@ <% -@initial_context_name = @context.name unless @context.nil? -@initial_context_name ||= @project.default_context.name unless @project.nil? || @project.default_context.nil? +@initial_context_name = @context.name if @context +@initial_context_name ||= @project.default_context.name unless @project.nil? || @project.default_context.nil? +@initial_context_name ||= @contexts.active.first.name unless @contexts.active.first.nil? @initial_context_name ||= @contexts.first.name unless @contexts.first.nil? @initial_project_name = @project.name unless @project.nil? @initial_tags ||= @default_tags