module Qyu::Helpers::Pagination
Public Instance Methods
next_pages_for(collection)
click to toggle source
# File lib/qyu/ui/helpers/pagination.rb, line 29 def next_pages_for(collection) return [] if collection.page == collection.total_pages end_page = [collection.total_pages, collection.page + 3].min (collection.page + 1).upto(end_page) end
previous_pages_for(collection)
click to toggle source
# File lib/qyu/ui/helpers/pagination.rb, line 23 def previous_pages_for(collection) return [] if collection.page < 2 start_page = [collection.page - 3, 1].max start_page.upto(collection.page - 1) end