mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 03:00:12 +01:00
fixes #677 - eagerly load default_context for projects
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@747 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
bde47e44c7
commit
93bbce7636
3 changed files with 4 additions and 5 deletions
|
|
@ -182,7 +182,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def init_data_for_sidebar
|
||||
@projects = @projects || current_user.projects
|
||||
@projects = @projects || current_user.projects.find(:all, :include => [:default_context ])
|
||||
@contexts = @contexts || current_user.contexts
|
||||
init_not_done_counts
|
||||
if prefs.show_hidden_projects_in_sidebar
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class TodosController < ApplicationController
|
|||
session :off, :only => :index, :if => Proc.new { |req| is_feed_request(req) }
|
||||
|
||||
def index
|
||||
@projects = current_user.projects.find(:all, :include => [ :todos ])
|
||||
@projects = current_user.projects.find(:all, :include => [ :todos, :default_context ])
|
||||
@contexts = current_user.contexts.find(:all, :include => [ :todos ])
|
||||
|
||||
@contexts_to_show = @contexts.reject {|x| x.hide? }
|
||||
|
|
@ -258,7 +258,7 @@ class TodosController < ApplicationController
|
|||
@source_view = 'deferred'
|
||||
@page_title = "TRACKS::Tickler"
|
||||
|
||||
@projects = current_user.projects.find(:all, :include => [ :todos ])
|
||||
@projects = current_user.projects.find(:all, :include => [ :todos, :default_context ])
|
||||
@contexts_to_show = @contexts = current_user.contexts.find(:all, :include => [ :todos ])
|
||||
|
||||
current_user.deferred_todos.find_and_activate_ready
|
||||
|
|
@ -415,7 +415,6 @@ class TodosController < ApplicationController
|
|||
|
||||
# Exclude hidden projects from the home page
|
||||
@not_done_todos = Todo.find(:all, :conditions => ['todos.user_id = ? and todos.state = ? AND contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', current_user.id, 'active', false, 'active'], :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", :include => [ :project, :context, :tags ])
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
has_many :projects,
|
||||
:order => 'position ASC',
|
||||
:order => 'projects.position ASC',
|
||||
:dependent => :delete_all do
|
||||
def find_by_params(params)
|
||||
find(params['id'] || params['project_id'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue