add done views to projects and recurring todos

This commit is contained in:
Reinier Balt 2011-06-20 06:50:25 +02:00
parent 5496b84642
commit 35f947ec57
13 changed files with 166 additions and 20 deletions

View file

@ -32,6 +32,24 @@ class ProjectsController < ApplicationController
end
end
end
def done
@source_view = params['_source_view'] || 'project_list'
@page_title = t('projects.list_completed_projects')
page = params[:page] || 1
projects_per_page = 20
@projects = current_user.projects.completed.paginate :page => page, :per_page => projects_per_page
@count = @projects.count
@total = current_user.projects.completed.count
@no_projects = @projects.empty?
@range_low = (page.to_i-1) * projects_per_page + 1
@range_high = @range_low + @projects.size - 1
init_not_done_counts(['project'])
render
end
def projects_and_actions
@projects = current_user.projects.active
@ -259,7 +277,8 @@ class ProjectsController < ApplicationController
@count = current_user.projects.count
@active_projects = current_user.projects.active
@hidden_projects = current_user.projects.hidden
@completed_projects = current_user.projects.completed
@completed_projects = current_user.projects.completed.find(:all, :limit => 10)
@completed_count = current_user.projects.completed.count
@no_projects = current_user.projects.empty?
current_user.projects.cache_note_counts
@new_project = current_user.projects.build

View file

@ -10,7 +10,7 @@ class RecurringTodosController < ApplicationController
find_and_inactivate
@recurring_todos = current_user.recurring_todos.active
@completed_recurring_todos = current_user.recurring_todos.completed
@completed_recurring_todos = current_user.recurring_todos.completed.find(:all, :limit => 10)
@no_recurring_todos = @recurring_todos.size == 0
@no_completed_recurring_todos = @completed_recurring_todos.size == 0
@ -24,6 +24,16 @@ class RecurringTodosController < ApplicationController
def show
end
def done
@page_title = t('todos.completed_recurring_actions_title')
items_per_page = 20
page = params[:page] || 1
@completed_recurring_todos = current_user.recurring_todos.completed.paginate :page => params[:page], :per_page => items_per_page
@total = @count = current_user.recurring_todos.completed.count
@range_low = (page.to_i-1) * items_per_page + 1
@range_high = @range_low + @completed_recurring_todos.size - 1
end
def edit
respond_to do |format|