will_paginate-bootstrap
This gem integrates the Twitter Bootstrap pagination component with the will_paginate pagination gem.
As with will_paginate itself, Rails and Sinatra are supported.
Install
-
gem install spinels-will_paginate-bootstrap
, or - For projects using Bundler, add
gem 'spinels-will_paginate-bootstrap'
to yourGemfile
(and then runbundle install
).
Usage
Rails
- Load the Bootstrap CSS in your template.
- In your view, use the
renderer: BootstrapPagination::Rails
option with thewill_paginate
helper, for example:
<%= will_paginate @collection, renderer: BootstrapPagination::Rails %>
Sinatra
- Load the Bootstrap CSS in your template.
-
require "will_paginate-bootstrap"
in your Sinatra app. - In your view, use the
renderer: BootstrapPagination::Sinatra
option with thewill_paginate
helper, for example:
<%= will_paginate @collection, renderer: BootstrapPagination::Sinatra %>
Bootstrap 3
For Bootstrap 3, the markup required has changed slightly from version 2. You can pass the bootstrap
option with a value >= 3 when calling will_paginate
to generate Bootstrap 3 compatible markup. For example:
<%= will_paginate @collection, renderer: BootstrapPagination::Rails, bootstrap: 3 %>
By default version 2 compatible markup will be generated.
Compatibility
Ruby | >= 1.9.2 |
---|---|
will_paginate | >= 3.0.3 |
Bootstrap | >= 2.0.0 |