A pagination helper for merb. Useful with dm-is-paginated or with Sequel’s built in pagination.
sudo gem install merb-pagination
Given a page count and the current page, we generate a set of pagination
We use an inner and outer window into a list of links. For a set of 20 pages with the current page being 10:
1 2 ... 19 20
5 6 7 8 9 10 11 12 13 14
This is totally adjustable, or can be turned off by giving the :inner_window setting a value of nil.
Demonstration of usage
:class => css_class
:prev_label => text_for_previous_link
'« Previous '
:next_labe => text_for_next_link
' Next »'
Used when the page numbers need to be cut off to prevent the set of pagination links from
being too long.
:left_cut_label => text_for_cut
Same as :left_cut_label but for the right side of numbers.
:right_cut_label => text_for_cut
Sets the number of pages to include in the outer ‘window’
:outer_window => number_of_pages
Sets the number of pags to include in the inner ‘window’
:inner_window => number_of_pages
Use the default CSS provided by the paginator. If you want to do your own custom styling of
the paginator from scratch, set this to false.
:default_css => use_paginator_provided_css
Sets the name of the paramiter the paginator uses to return what
page is being requested.
:page_param => name_of_page_paramiter
Provides the base url to use in the page navigation links.
:url => url_for_links
<%%= paginate(@current_page, @page_count, :inner_window => 5) %%>
Google Groups / Mailing List
How to submit patches
You can fetch the source from github:
git clone git://github.com/lholden/merb-pagination.git
Build and test instructions
cd merb-pagination rake test rake install_gem
This code is free to use under the terms of the MIT license.
Comments are welcome, and can be sent via Google Groups