move will_paginate on all_todos pages to will_paginate-bootstrap gem to get the bootstrap

styling for free. Adds caching to todos/done page too
This commit is contained in:
Reinier Balt 2013-07-29 12:25:13 +02:00
parent d139693632
commit 7605ec404f
6 changed files with 46 additions and 31 deletions

View file

@ -32,6 +32,8 @@ class TodosController < ApplicationController
# Set count badge to number of not-done, not hidden context items
@count = current_user.todos.active.not_hidden.count(:all)
@todos_without_project = @not_done_todos.select{|t|t.project.nil?}
@last_updated_todo_without_project = @todos_without_project
.inject(@todos_without_project.first){ |last, todo| todo.updated_at > last.updated_at ? todo : last }
end
format.m do
@page_title = t('todos.mobile_todos_page_title')
@ -536,7 +538,11 @@ class TodosController < ApplicationController
@source_view = 'done'
@page_title = t('todos.completed_tasks_title')
@done = current_user.todos.completed.includes(Todo::DEFAULT_INCLUDES).reorder('completed_at DESC').paginate :page => params[:page], :per_page => 20
@done = current_user.todos.completed
.includes(Todo::DEFAULT_INCLUDES)
.reorder('completed_at DESC')
.page(params[:page]).per_page(20)
@count = @done.size
end