Custom will_paginate render fails with new version. Removed.

This commit is contained in:
Christoph Haas 2018-08-07 18:41:44 +02:00
parent 459e86e25a
commit 0a7559f9a4

View file

@ -1,55 +0,0 @@
include WillPaginate
class FoundationPaginationRenderer < WillPaginate::ActionView::LinkRenderer
def to_html
list_items = pagination.map do |item|
case item
when Integer # ruby 2.4
page_number(item)
else
send(item)
end
end.join(@options[:link_separator])
tag("ul", list_items, class: 'pagination', role: 'navigation', 'aria-label' => 'Pagination')
end
def container_attributes
super.except(*[:link_options])
end
protected
def page_number(page)
link_options = @options[:link_options] || {}
if page == current_page
tag :li, page, :class => ('current')
else
tag :li, link(page, page, link_options.merge(:rel => rel_value(page)))
end
end
def previous_or_next_page(page, text, classname)
link_options = @options[:link_options] || {}
if page
tag :li, link(text, page, link_options), :class => classname
else
tag :li, '', :class => "%s disabled" % classname
end
end
def gap
tag :li, '', class: 'ellipsis', 'aria-hidden' => 'true'
end
def previous_page
num = @collection.current_page > 1 && @collection.current_page - 1
previous_or_next_page(num, '', "pagination-previous")
end
def next_page
num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
previous_or_next_page(num, '', "pagination-next")
end
end