From aa99b78c1bdd71c637da10ffba53c0d9affbb8a0 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 19 Dec 2011 02:33:41 +0900 Subject: [PATCH] fix merge mistake --- lib/kaminari/helpers/action_view_extension.rb | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/kaminari/helpers/action_view_extension.rb b/lib/kaminari/helpers/action_view_extension.rb index 573fcab9b..8ddf7ae53 100644 --- a/lib/kaminari/helpers/action_view_extension.rb +++ b/lib/kaminari/helpers/action_view_extension.rb @@ -42,38 +42,38 @@ def link_to_next_page(scope, name, options = {}, &block) link_to_unless scope.last_page?, name, params.merge(param_name => (scope.current_page + 1)), options.reverse_merge(:rel => 'next') do block.call if block end + end - # Renders a helpful message with numbers of displayed vs. total entries. - # Ported from mislav/will_paginate - # - # ==== Examples - # Basic usage: - # - # <%= page_entries_info @posts %> - # #-> Displaying posts 6 - 10 of 26 in total - # - # By default, the message will use the humanized class name of objects - # in collection: for instance, "project types" for ProjectType models. - # Override this with the :entry_name parameter: - # - # <%= page_entries_info @posts, :entry_name => 'item' %> - # #-> Displaying items 6 - 10 of 26 in total - def page_entries_info(collection, options = {}) - entry_name = options[:entry_name] || (collection.empty?? 'entry' : collection.first.class.name.underscore.sub('_', ' ')) - if collection.num_pages < 2 - case collection.total_count - when 0; "No #{entry_name.pluralize} found" - when 1; "Displaying 1 #{entry_name}" - else; "Displaying all #{collection.total_count} #{entry_name.pluralize}" - end - else - offset = (collection.current_page - 1) * collection.limit_value - %{Displaying #{entry_name.pluralize} %d - %d of %d in total} % [ - offset + 1, - offset + collection.count, - collection.total_count - ] + # Renders a helpful message with numbers of displayed vs. total entries. + # Ported from mislav/will_paginate + # + # ==== Examples + # Basic usage: + # + # <%= page_entries_info @posts %> + # #-> Displaying posts 6 - 10 of 26 in total + # + # By default, the message will use the humanized class name of objects + # in collection: for instance, "project types" for ProjectType models. + # Override this with the :entry_name parameter: + # + # <%= page_entries_info @posts, :entry_name => 'item' %> + # #-> Displaying items 6 - 10 of 26 in total + def page_entries_info(collection, options = {}) + entry_name = options[:entry_name] || (collection.empty?? 'entry' : collection.first.class.name.underscore.sub('_', ' ')) + if collection.num_pages < 2 + case collection.total_count + when 0; "No #{entry_name.pluralize} found" + when 1; "Displaying 1 #{entry_name}" + else; "Displaying all #{collection.total_count} #{entry_name.pluralize}" end + else + offset = (collection.current_page - 1) * collection.limit_value + %{Displaying #{entry_name.pluralize} %d - %d of %d in total} % [ + offset + 1, + offset + collection.count, + collection.total_count + ] end end end