Sha256: 4d3e3915115c450538bf28da02740217764e7f151689ca44a5872f7f80fd6c9c
Contents?: true
Size: 1.94 KB
Versions: 2
Compression:
Stored size: 1.94 KB
Contents
Neat Pages [](http://travis-ci.org/demarque/neat-pages) =============== A simple pagination API to paginate Mongoid Models. Install ------- ``` gem install neat-pages ``` Rails 3 ------- In your Gemfile: ```ruby gem 'neat-pages' ``` Setup ----- First you need to link the assets. In your css manifest put : ``` require neat_pages ``` In your javascript manifest put : ``` require neat_pages ``` You only need to require the javascript if you use the AJAX functionnality. That's it. Usage ----- Examples -------- ### Minimal integration In your controller *(app/controllers/products_controller.rb)* ```ruby def index paginate @products = Product.all.paginate(pagination) end ``` In your view *(app/views/products/index.html.erb)* ```erb <%= render 'products', products: @products %> <%= neat_pages_navigation %> ``` ### Summon the power of AJAX In your controller *(app/controllers/products_controller.rb)* ```ruby def index paginate @products = Product.all.paginate(pagination) end ``` In your view *(app/views/products/index.html.erb)* ```erb <%= neat_pages_ajax_items 'products', products: @products %> <%= neat_pages_navigation %> ``` Create the file *app/views/products/index.neatpage.erb* and place the following code in it. ```erb <% self.formats = ["html"] %> <%= render 'products', products: @products %> ``` ### Events #### `neat_pages:update` Triggered on `'body'` whenever a page has changed, from cache or from server. The event data is an object literal which holds those fields: `noPage` The current page number Locales ------- If you want to translate the text in the pagination helpers, just add the following keys in i18n. ```yml fr: neat_pages: next_page: Page suivante previous_page: Page précédente ``` Copyright --------- Copyright (c) 2013 De Marque inc. See LICENSE for further details.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
neat-pages-0.1.7 | README.md |
neat-pages-0.1.6 | README.md |