Module: Qyu::Helpers::Pagination
- Included in:
- UI
- Defined in:
- lib/qyu/ui/helpers/pagination.rb
Defined Under Namespace
Classes: PaginatableArray
Instance Method Summary
collapse
Instance Method Details
#next_pages_for(collection) ⇒ Object
28
29
30
31
32
|
# File 'lib/qyu/ui/helpers/pagination.rb', line 28
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) ⇒ Object
22
23
24
25
26
|
# File 'lib/qyu/ui/helpers/pagination.rb', line 22
def previous_pages_for(collection)
return [] if collection.page < 2
start_page = [collection.page - 3, 1].max
start_page.upto(collection.page - 1)
end
|