merb-pagination
Get Version
0.0.1What
A pagination helper for merb. Useful with dm-is-paginated or with Sequel’s built in pagination.
Installing
sudo gem install merb-pagination
The basics
Given a page count and the current page, we generate a set of pagination
links.
We use an inner and outer window into a list of links. For a set of 20 pages with the current page being 10:
outer_window: 1 2 ... 19 20
inner_window: 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
Options
:class => css_class
'paginated'
:prev_label => text_for_previous_link
'« Previous '
:next_labe => text_for_next_link
Defaults to ' Next »'
:left_cut_label => text_for_cut
'←'
:right_cut_label => text_for_cut
'→'
:outer_window => number_of_pages
2
:inner_window => number_of_pages
10
:default_css => use_paginator_provided_css
true
:page_param => name_of_page_paramiter
'page'
:url => url_for_links
''
Example:
<%%= paginate(@current_page, @page_count, :inner_window => 5) %%>
Google Groups / Mailing List
http://groups.google.com/group/merb-pagination
How to submit patches
Read the 8 steps for fixing other people’s code and for section 8b: Submit patch to Google Groups, use the Google Group above.
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
License
This code is free to use under the terms of the MIT license.
Contact
Comments are welcome, and can be sent via Google Groups
Lori Holden, 12th October 2008
Theme extended from Paul Battley