Module: PaginationHelper
- Defined in:
- app/helpers/pagination_helper.rb
Instance Method Summary collapse
- #page_size ⇒ Object
-
#paginate_collection(collection, remote: nil, total_pages: nil) ⇒ Object
total_pages will be inferred from the collection if nil.
- #paginate_with_count(collection, remote: nil, total_pages: nil) ⇒ Object
- #paginate_without_count(collection) ⇒ Object
Instance Method Details
#page_size ⇒ Object
26 27 28 |
# File 'app/helpers/pagination_helper.rb', line 26 def page_size Kaminari.config.default_per_page end |
#paginate_collection(collection, remote: nil, total_pages: nil) ⇒ Object
total_pages will be inferred from the collection if nil. It is ignored if the collection is a Kaminari::PaginatableWithoutCount
6 7 8 9 10 11 12 |
# File 'app/helpers/pagination_helper.rb', line 6 def paginate_collection(collection, remote: nil, total_pages: nil) if collection.is_a?(Kaminari::PaginatableWithoutCount) paginate_without_count(collection) elsif collection.respond_to?(:total_pages) paginate_with_count(collection, remote: remote, total_pages: total_pages) end end |
#paginate_with_count(collection, remote: nil, total_pages: nil) ⇒ Object
22 23 24 |
# File 'app/helpers/pagination_helper.rb', line 22 def paginate_with_count(collection, remote: nil, total_pages: nil) paginate(collection, remote: remote, theme: 'gitlab', total_pages: total_pages) end |
#paginate_without_count(collection) ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/helpers/pagination_helper.rb', line 14 def paginate_without_count(collection) render( 'kaminari/gitlab/without_count', previous_path: path_to_prev_page(collection), next_path: path_to_next_page(collection) ) end |