add recurring_todos to done_overview and fix routes

This commit is contained in:
Reinier Balt 2011-06-12 05:38:45 +02:00
parent aa3fbf0d1e
commit c61238933c
5 changed files with 27 additions and 22 deletions

View file

@ -1,6 +1,6 @@
class StatsController < ApplicationController class StatsController < ApplicationController
helper :todos, :projects helper :todos, :projects, :recurring_todos
append_before_filter :init, :exclude => [] append_before_filter :init, :exclude => []
@ -646,13 +646,11 @@ class StatsController < ApplicationController
def done def done
@source_view = 'done' @source_view = 'done'
@done_recently = current_user.todos.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])
init_not_done_counts(['project'])
@last_completed_projects = current_user.projects.completed.all(:limit => 10, :order => 'completed_at DESC')
@last_completed_contexts = [] @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 end
private private

View file

@ -82,6 +82,8 @@ class Project < ActiveRecord::Base
end end
def note_count def note_count
# TODO: test this for eager and not eager loading!!!
return 0 if notes.size == 0
cached_note_count || notes.count cached_note_count || notes.count
end end

View file

@ -68,7 +68,7 @@
<li><a href="#"><%= t('layouts.navigation.view') %></a> <li><a href="#"><%= t('layouts.navigation.view') %></a>
<ul> <ul>
<li><%= navigation_link( t('layouts.navigation.calendar'), calendar_path, :title => t('layouts.navigation.calendar_title')) %></li> <li><%= navigation_link( t('layouts.navigation.calendar'), calendar_path, :title => t('layouts.navigation.calendar_title')) %></li>
<li><%= navigation_link( t('layouts.navigation.completed_tasks'), done_path, {:accesskey=>"d", :title=>t('layouts.navigation.completed_tasks_title')} ) %></li> <li><%= navigation_link( t('layouts.navigation.completed_tasks'), done_overview_path, {:accesskey=>"d", :title=>t('layouts.navigation.completed_tasks_title')} ) %></li>
<li><%= navigation_link( t('layouts.navigation.feeds'), {:controller => "feedlist", :action => "index"}, :title => t('layouts.navigation.feeds_title')) %></li> <li><%= navigation_link( t('layouts.navigation.feeds'), {:controller => "feedlist", :action => "index"}, :title => t('layouts.navigation.feeds_title')) %></li>
<li><%= navigation_link( t('layouts.navigation.stats'), {:controller => "stats", :action => "index"}, :title => t('layouts.navigation.stats_title')) %></li> <li><%= navigation_link( t('layouts.navigation.stats'), {:controller => "stats", :action => "index"}, :title => t('layouts.navigation.stats_title')) %></li>
</ul> </ul>

View file

@ -29,16 +29,17 @@
</div> </div>
<div class="container"> <div class="container">
<div class=add_note_link><%= link_to "Show all", done_contexts_path%></div> <div class=add_note_link><%= link_to "Show all", done_recurring_todos_path%></div>
<h2> <h2>
<%= t('common.last') %> <%= t('states.completed_plural' )%> <%= t('common.contexts') %> <%= t('common.last') %> <%= t('states.completed_plural' )%> <%= t('common.recurring_todos') %>
</h2> </h2>
<% if @last_completed_contexts.empty? -%> <% if @last_completed_recurring_todos.empty? -%>
<div class="message"><p><%= t('projects.no_last_completed_contexts') %></p></div> <div class="message"><p><%= t('projects.no_last_completed_recurring_todos') %></p></div>
<% else -%> <% else -%>
TODO <%= render :partial => '/recurring_todos/recurring_todo', :collection => @last_completed_recurring_todos %>
<% end -%> <% end -%>
</div> </div>
</div><!-- End of display_box --> </div><!-- End of display_box -->

View file

@ -13,15 +13,15 @@ ActionController::Routing::Routes.draw do |map|
end end
map.with_options :controller => :contexts do |contexts| map.with_options :controller => :contexts do |contexts|
contexts.done 'contexts/done', :action => 'completed' contexts.done_contexts 'contexts/done', :action => 'done'
end 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_" projects.resources :todos, :name_prefix => "project_"
end end
map.with_options :controller => :projects do |projects| map.with_options :controller => :projects do |projects|
projects.done 'projects/done', :action => 'completed' projects.done_projects 'projects/done', :action => 'done'
end end
map.resources :notes map.resources :notes
@ -29,7 +29,7 @@ ActionController::Routing::Routes.draw do |map|
map.resources :todos, map.resources :todos,
:member => {:toggle_check => :put, :toggle_star => :put}, :member => {:toggle_check => :put, :toggle_star => :put},
:collection => {:check_deferred => :post, :filter_to_context => :post, :filter_to_project => :post, :collection => {:check_deferred => :post, :filter_to_context => :post, :filter_to_project => :post,
:done => :get, :all_done => :get} }
map.with_options :controller => :todos do |todos| map.with_options :controller => :todos do |todos|
todos.home '', :action => "index" 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.mobile_todo_show_notes 'todos/notes/:id.m', :action => "show_notes", :format => 'm'
todos.todo_show_notes 'todos/notes/:id', :action => "show_notes" 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 end
map.root :controller => 'todos' # Make OpenID happy because it needs #root_url defined map.root :controller => 'todos' # Make OpenID happy because it needs #root_url defined
map.resources :recurring_todos, map.resources :recurring_todos,
:member => {:toggle_check => :put, :toggle_star => :put} :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 'login', :action => 'login'
login.login_cas 'login_cas', :action => 'login_cas' login.login_cas 'login_cas', :action => 'login_cas'
login.formatted_login 'login.:format', :action => 'login' login.formatted_login 'login.:format', :action => 'login'
@ -71,12 +76,12 @@ ActionController::Routing::Routes.draw do |map|
login.formatted_logout 'logout.:format', :action => 'logout' login.formatted_logout 'logout.:format', :action => 'logout'
end 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.mobile_feeds 'feeds.m', :action => 'index', :format => 'm'
fl.feeds 'feeds', :action => 'index' fl.feeds 'feeds', :action => 'index'
end end
map.with_options :controller => "integrations" do |i| map.with_options :controller => :integrations do |i|
i.integrations 'integrations', :action => 'index' i.integrations 'integrations', :action => 'index'
i.rest_api_docs 'integrations/rest_api', :action => "rest_api" i.rest_api_docs 'integrations/rest_api', :action => "rest_api"
i.search_plugin 'integrations/search_plugin.xml', :controller => 'integrations', :action => 'search_plugin', :format => 'xml' 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.search 'search', :controller => 'search', :action => 'index'
map.data 'data', :controller => 'data', :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' map.connect '/selenium_helper/login', :controller => 'selenium_helper', :action => 'login' if Rails.env == 'test'
Translate::Routes.translation_ui(map) if Rails.env != "production" Translate::Routes.translation_ui(map) if Rails.env != "production"