diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index 59c16ee7..25e125e0 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -1,6 +1,6 @@ class StatsController < ApplicationController - helper :todos, :projects + helper :todos, :projects, :recurring_todos append_before_filter :init, :exclude => [] @@ -646,13 +646,11 @@ class StatsController < ApplicationController def done @source_view = 'done' - @done_recently = current_user.todos.completed.all(:limit => 10, :order => 'completed_at DESC') - - init_not_done_counts(['project']) - @last_completed_projects = current_user.projects.completed.all(:limit => 10, :order => 'completed_at DESC') - + @done_recently = current_user.todos.completed.all(:limit => 10, :order => 'completed_at DESC', :include => [:project, :context, :tags, :taggings]) + @last_completed_projects = current_user.projects.completed.all(:limit => 10, :order => 'completed_at DESC', :include => [:todos, :notes]) @last_completed_contexts = [] - #@last_completed_contexts = current_user.contexts.completed.all(:limit => 10, :order => 'completed_at DESC') + @last_completed_recurring_todos = current_user.recurring_todos.completed.all(:limit => 10, :order => 'completed_at DESC') + #TODO: @last_completed_contexts = current_user.contexts.completed.all(:limit => 10, :order => 'completed_at DESC') end private diff --git a/app/models/project.rb b/app/models/project.rb index 5cb0ed9a..00854394 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -82,6 +82,8 @@ class Project < ActiveRecord::Base end def note_count + # TODO: test this for eager and not eager loading!!! + return 0 if notes.size == 0 cached_note_count || notes.count end diff --git a/app/views/layouts/standard.html.erb b/app/views/layouts/standard.html.erb index d325b4f2..9758e2c5 100644 --- a/app/views/layouts/standard.html.erb +++ b/app/views/layouts/standard.html.erb @@ -68,7 +68,7 @@
  • <%= t('layouts.navigation.view') %> diff --git a/app/views/stats/done.html.erb b/app/views/stats/done.html.erb index efe5875f..c6f38371 100644 --- a/app/views/stats/done.html.erb +++ b/app/views/stats/done.html.erb @@ -29,16 +29,17 @@
    - +

    - <%= t('common.last') %> <%= t('states.completed_plural' )%> <%= t('common.contexts') %> + <%= t('common.last') %> <%= t('states.completed_plural' )%> <%= t('common.recurring_todos') %>

    - <% if @last_completed_contexts.empty? -%> -

    <%= t('projects.no_last_completed_contexts') %>

    + <% if @last_completed_recurring_todos.empty? -%> +

    <%= t('projects.no_last_completed_recurring_todos') %>

    <% else -%> - TODO + <%= render :partial => '/recurring_todos/recurring_todo', :collection => @last_completed_recurring_todos %> <% end -%>
    + diff --git a/config/routes.rb b/config/routes.rb index 2f0ca03f..be51e07a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,15 +13,15 @@ ActionController::Routing::Routes.draw do |map| end map.with_options :controller => :contexts do |contexts| - contexts.done 'contexts/done', :action => 'completed' + contexts.done_contexts 'contexts/done', :action => 'done' end - map.resources :projects, :collection => {:order => :post, :alphabetize => :post, :actionize => :post, :done => :get} do |projects| + map.resources :projects, :collection => {:order => :post, :alphabetize => :post, :actionize => :post} do |projects| projects.resources :todos, :name_prefix => "project_" end map.with_options :controller => :projects do |projects| - projects.done 'projects/done', :action => 'completed' + projects.done_projects 'projects/done', :action => 'done' end map.resources :notes @@ -29,7 +29,7 @@ ActionController::Routing::Routes.draw do |map| map.resources :todos, :member => {:toggle_check => :put, :toggle_star => :put}, :collection => {:check_deferred => :post, :filter_to_context => :post, :filter_to_project => :post, - :done => :get, :all_done => :get} + } map.with_options :controller => :todos do |todos| todos.home '', :action => "index" @@ -56,14 +56,19 @@ ActionController::Routing::Routes.draw do |map| todos.mobile_todo_show_notes 'todos/notes/:id.m', :action => "show_notes", :format => 'm' todos.todo_show_notes 'todos/notes/:id', :action => "show_notes" + todos.done_todos 'todos/done', :action => :done + todos.all_done_todos 'todos/all_done', :action => :all_done end map.root :controller => 'todos' # Make OpenID happy because it needs #root_url defined map.resources :recurring_todos, :member => {:toggle_check => :put, :toggle_star => :put} - map.recurring_todos 'recurring_todos', :controller => 'recurring_todos', :action => 'index' + map.with_options :controller => :recurring_todos do |rt| + rt.recurring_todos 'recurring_todos', :action => 'index' + rt.done_recurring_todos 'recurring_todos/done', :action => 'done' + end - map.with_options :controller => 'login' do |login| + map.with_options :controller => :login do |login| login.login 'login', :action => 'login' login.login_cas 'login_cas', :action => 'login_cas' login.formatted_login 'login.:format', :action => 'login' @@ -71,12 +76,12 @@ ActionController::Routing::Routes.draw do |map| login.formatted_logout 'logout.:format', :action => 'logout' end - map.with_options :controller => "feedlist" do |fl| + map.with_options :controller => :feedlist do |fl| fl.mobile_feeds 'feeds.m', :action => 'index', :format => 'm' fl.feeds 'feeds', :action => 'index' end - map.with_options :controller => "integrations" do |i| + map.with_options :controller => :integrations do |i| i.integrations 'integrations', :action => 'index' i.rest_api_docs 'integrations/rest_api', :action => "rest_api" i.search_plugin 'integrations/search_plugin.xml', :controller => 'integrations', :action => 'search_plugin', :format => 'xml' @@ -92,7 +97,6 @@ ActionController::Routing::Routes.draw do |map| map.search 'search', :controller => 'search', :action => 'index' map.data 'data', :controller => 'data', :action => 'index' - map.done 'done', :controller => 'todos', :action => 'completed_overview' map.connect '/selenium_helper/login', :controller => 'selenium_helper', :action => 'login' if Rails.env == 'test' Translate::Routes.translation_ui(map) if Rails.env != "production"