Merge pull request #1478 from consul/kaminari-updated
removes not needed code
This commit is contained in:
@@ -8,50 +8,3 @@ Kaminari.configure do |config|
|
||||
# config.page_method_name = :page
|
||||
# config.param_name = :page
|
||||
end
|
||||
|
||||
|
||||
# Overrides for making Kaminari handle i18n pluralization correctly
|
||||
#
|
||||
# Remove everything below once https://github.com/amatsuda/kaminari/pull/694 is
|
||||
# merged in Kaminari and we have updated
|
||||
module Kaminari
|
||||
|
||||
module ActionViewExtension
|
||||
def page_entries_info(collection, options = {})
|
||||
entry_name = if options[:entry_name]
|
||||
options[:entry_name].pluralize(collection.size)
|
||||
else
|
||||
collection.entry_name(:count => collection.size).downcase
|
||||
end
|
||||
|
||||
if collection.total_pages < 2
|
||||
t('helpers.page_entries_info.one_page.display_entries', entry_name: entry_name, count: collection.total_count)
|
||||
else
|
||||
first = collection.offset_value + 1
|
||||
last = collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value
|
||||
t('helpers.page_entries_info.more_pages.display_entries', entry_name: entry_name, first: first, last: last, total: collection.total_count)
|
||||
end.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
module ActiveRecordRelationMethods
|
||||
def entry_name(options = {})
|
||||
model_name.human(options.reverse_merge(default: model_name.human.pluralize(options[:count])))
|
||||
end
|
||||
end
|
||||
|
||||
module MongoidCriteriaMethods
|
||||
def entry_name(options = {})
|
||||
model_name.human(options.reverse_merge(default: model_name.human.pluralize(options[:count])))
|
||||
end
|
||||
end
|
||||
|
||||
class PaginatableArray < Array
|
||||
ENTRY = 'entry'.freeze
|
||||
|
||||
def entry_name(options = {})
|
||||
I18n.t('helpers.page_entries_info.entry', options.reverse_merge(default: ENTRY.pluralize(options[:count])))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user