diff --git a/Gemfile b/Gemfile index 8afded69..8d2545a8 100644 --- a/Gemfile +++ b/Gemfile @@ -35,7 +35,7 @@ gem 'mousetrap-rails' gem "RedCloth" gem "sanitize" -gem "will_paginate" +gem "will_paginate-bootstrap" gem "acts_as_list" gem "aasm" gem "htmlentities" diff --git a/Gemfile.lock b/Gemfile.lock index a083aa28..25b0e5d4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -206,6 +206,8 @@ GEM uniform_notifier (1.2.0) websocket (1.0.7) will_paginate (3.0.4) + will_paginate-bootstrap (0.2.3) + will_paginate (>= 3.0.3) xpath (2.0.0) nokogiri (~> 1.3) yard (0.8.7) @@ -250,5 +252,5 @@ DEPENDENCIES turbolinks twitter-bootstrap-rails! uglifier (>= 1.3.0) - will_paginate + will_paginate-bootstrap yard diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index 551ed1be..ea823b25 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -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 diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 65a200d1..91e702c7 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -87,11 +87,11 @@ module TodosHelper end def todos_container_header(settings={}) - header = settings[:link_in_header].nil? ? "" : content_tag(:div, :class=>"add_note_link"){settings[:link_in_header]} - header += content_tag(:h4) do + link = settings[:link_in_header].nil? ? "" : content_tag(:span, :class=>"add-note-link"){"(#{settings[:link_in_header]})".html_safe} + header = content_tag(:h4) do toggle = "" # TODO: toggle = settings[:collapsible] ? container_toggle("toggle_#{settings[:id]}") : "" - "#{toggle} #{settings[:title]} #{settings[:append_descriptor]}".html_safe + "#{toggle} #{settings[:title]} #{settings[:append_descriptor]} #{link}".html_safe end header.html_safe end diff --git a/app/views/todos/all_done.html.erb b/app/views/todos/all_done.html.erb index d55c05c1..4b238d2b 100644 --- a/app/views/todos/all_done.html.erb +++ b/app/views/todos/all_done.html.erb @@ -1,22 +1,24 @@ <% paginate_options = { - :class => :add_note_link, - :previous_label => '« '+ t('common.previous'), - :next_label => t('common.next')+' »', - :inner_window => 2 + class: 'pagination pagination-small', + previous_label: '« '+ t('common.previous'), + next_label: t('common.next')+' »', + inner_window: 2, + renderer: BootstrapPagination::Rails } %> -
+<% cache [@done_rest_of_week.first, "done_rest_of_week"] do -%> + <%= show_completed_todos_for("rest_of_week", @done_rest_of_week) %> +<% end -%> + +<% cache [@done_rest_of_month.first, "done_rest_of_month"] do -%> + <%= show_completed_todos_for("rest_of_month", @done_rest_of_month) %> +<% end -%> + +
<%= raw t('todos.see_all_completed', :link => link_to(t("todos.all_completed_here"), determine_all_done_path)) %> -
- -