Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add html_safe to page_entries_info helper

  • Loading branch information...
commit e2652f1461db00fd08b72fc15776ba376edeaaa5 1 parent 17ff527
@lucapette lucapette authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/kaminari/helpers/action_view_extension.rb
View
6 lib/kaminari/helpers/action_view_extension.rb
@@ -61,20 +61,22 @@ def link_to_next_page(scope, name, options = {}, &block)
# #-> 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('_', ' '))
+ output = ""
if collection.num_pages < 2
- case collection.total_count
+ output = 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} % [
+ output = %{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
+ output.html_safe
end
end
end

0 comments on commit e2652f1

Please sign in to comment.
Something went wrong with that request. Please try again.