Module: Middleman::Pagination
- Defined in:
- lib/middleman-core/core_extensions/collections/pagination.rb
Defined Under Namespace
Modules: ArrayHelpers
Class Method Summary collapse
Class Method Details
.page_locals(page_num, num_pages, collection, items, page_start) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/middleman-core/core_extensions/collections/pagination.rb', line 40 def self.page_locals(page_num, num_pages, collection, items, page_start) per_page = items.length # Index into collection of the last item of this page page_end = (page_start + per_page) - 1 ::Middleman::Util.recursively_enhance(page_number: page_num, num_pages: num_pages, per_page: per_page, # The range of item numbers on this page # (1-based, for showing "Items X to Y of Z") page_start: page_start + 1, page_end: [page_end + 1, collection.length].min, # Use "collection" in templates. collection: collection) end |