Grasshopper Pagination
Integrates Zurb Foundation's pagination styles with will_paginate.
Based on foundation-will_paginate with several changes:
- When gap is clicked, display an input field for exact page number, hit enter will navigate the the particular page
- Change default inner_window to 1
- When total count is no more than 1.5 times of per_page count, do not show pagination links, display all records
Installation
Add this line to your application's Gemfile:
gem 'grasshopper_paginate'
And then execute:
$ bundle
Or install it yourself as:
$ gem install grasshopper_paginate
Configuration
Include assets
application.js
//= require grasshopper_paginate/paginate
application.css
//= require grasshopper_paginate/paginate
Usage
For paginated query, with will_paginate, you woul usually use
@users = User.paginate page: params[:page]
Now use
@users = User.smart_paginate page: params[:page]
In your view where you would usually use
<%= will_paginate @posts %>
Now use
<%= grasshopper_paginate @posts %>
Contributing
- Fork it
- 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 new Pull Request