README.md in ajax_pagination-0.5.0 vs README.md in ajax_pagination-0.5.1

- old
+ new

@@ -5,16 +5,16 @@ Handles AJAX pagination for you, by hooking up the links you want to load content with javascript in designated page containers. Each webpage can have multiple page containers, each with a different set of pagination links. The page containers can be nested. Degrades gracefully when javascript is disabled. Basically, there is a helper function to use to create a section in your webpage, where content can be changed. Links can reference the section, and thus load new content into it. -This gem currently assumes you are using Rails 3.1+, and the assets pipeline for the javascript and css files. - For more, see [Introduction and Background](https://github.com/ronalchn/ajax_pagination/wiki/Introduction-and-Background). +This gem requires Rails 3.0+. When using the asset pipeline in Rails 3.1+, follow the general installation instructions. Otherwise, use the ajax_pagination:assets generator, which puts the assets into the public/ directory. + ## Installation -Add to your Gemfile: +Assuming, you are using the asset pipeline, add to your Gemfile: gem 'ajax_pagination' and run the bundle install command. @@ -31,9 +31,36 @@ ```css /* app/assets/stylesheets/application.css *= require ajax_pagination */ ``` + +To use this on Rails 3.0, or without using the asset pipeline, read [Installation without the Asset Pipeline](https://github.com/ronalchn/ajax_pagination/wiki/Installing-without-the-Asset-Pipeline) guide. + +## Basic Usage +In the ActionView, use ajax_section to declare a section, and ajax_link_to to create a link loading content into the section: + +```erb +<%= ajax_link_to "Link", link_url, :pagination => "section_name" %> +<%= ajax_section :pagination => "section_name", :render => "mypartial" %> +``` + +Then, in the ActionController, use ajax_respond to render only the partial when an AJAX request is made: + +```ruby +Class ObjectsController < ApplicationController + def index + ... + respond_to do |format| + format.html # index.html.erb + ajax_respond format, :pagination => "section_name", :render => "_mypartial" + end + end + ... +end +``` + +Much more information can be found in the wiki. ## Getting Started To learn how to use this gem, read one of the usage guides below (found in the wiki): * [Adding AJAX to will_paginate](https://github.com/ronalchn/ajax_pagination/wiki/Adding-AJAX-to-will_paginate)