Skip to content

Commit

Permalink
fix merge mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
amatsuda committed Dec 18, 2011
1 parent c2b6815 commit aa99b78
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions lib/kaminari/helpers/action_view_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tt>:entry_name</tt> 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 <b>1</b> #{entry_name}"
else; "Displaying <b>all #{collection.total_count}</b> #{entry_name.pluralize}"
end
else
offset = (collection.current_page - 1) * collection.limit_value
%{Displaying #{entry_name.pluralize} <b>%d&nbsp;-&nbsp;%d</b> of <b>%d</b> 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 <tt>:entry_name</tt> 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 <b>1</b> #{entry_name}"
else; "Displaying <b>all #{collection.total_count}</b> #{entry_name.pluralize}"
end
else
offset = (collection.current_page - 1) * collection.limit_value
%{Displaying #{entry_name.pluralize} <b>%d&nbsp;-&nbsp;%d</b> of <b>%d</b> in total} % [
offset + 1,
offset + collection.count,
collection.total_count
]
end
end
end
Expand Down

0 comments on commit aa99b78

Please sign in to comment.