Roda::WillPaginate
Use this plugin to use Will Paginate from Roda.
Installation
Add this line to your application's Gemfile:
gem 'roda-will_paginate'
And then execute:
$ bundle
Or install it yourself as:
$ gem install roda-will_paginate
Usage
Add the plugin directive to your app
plugin :will_paginate
On your views you can use the same method you would use on a Rails app ie.
<%= will_paginate @collection %>
to include pagination links.
In case you would like to customize the generated links you need to implement a renderer.
Twitter Bootstrap Pagination:
We include a customized renderer if you are working with Twitter bootstrap, just:
require 'roda/will_paginate/bootstrap_pagination_renderer'
in you application and then specify the renderer to Will Paginate:
<%= will_paginate @collection, renderer: :bootstrap %>
or
<%= will_paginate @collection, renderer: Roda::WillPaginate::BootstrapPaginationRenderer %>
Alternative you can set it in the plugin configuration to avoid repeating it in each helper call:
plugin :will_paginate, renderer: :bootstrap
or
plugin :will_paginate, renderer: Roda::WillPaginate::BootstrapPaginationRenderer
Custom renderers
Please take a look at the Will Paginate docs to see how renderers work.
If you have a custom renderer named Foo you can namespace it inside Roda::WillPaginate::FooRenderer
and then use the symbol :foo
to refer to it. For example:
plugin :will_paginate, renderer: :foo
Contributing
- Fork it ( https://github.com/manuca/roda-will_paginate/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request