will_paginate

https://github.com/mislav/will_paginate

Ruby

Pagination library for Rails and other Ruby applications

WillPaginate::ViewHelpers#will_paginate

Returns HTML representing page links for a WillPaginate::Collection-like object.
In case there is no more than one page in total, nil is returned.

==== Options
* <tt>:class</tt> -- CSS class name for the generated DIV (default: "pagination")
* <tt>:previous_label</tt> -- default: "« Previous"
* <tt>:next_label</tt> -- default: "Next »"
* <tt>:inner_window</tt> -- how many links are shown around the current page (default: 4)
* <tt>:outer_window</tt> -- how many links are around the first and the last page (default: 1)
* <tt>:link_separator</tt> -- string separator for page HTML elements (default: single space)
* <tt>:param_name</tt> -- parameter name for page number in URLs (default: <tt>:page</tt>)
* <tt>:params</tt> -- additional parameters when generating pagination links
  (eg. <tt>:controller => "foo", :action => nil</tt>)
* <tt>:renderer</tt> -- class name, class or instance of a link renderer (default in Rails:
  <tt>WillPaginate::ActionView::LinkRenderer</tt>)
* <tt>:page_links</tt> -- when false, only previous/next links are rendered (default: true)
* <tt>:container</tt> -- toggles rendering of the DIV container for pagination links, set to
  false only when you are rendering your own pagination markup (default: true)

All options not recognized by will_paginate will become HTML attributes on the container
element for pagination links (the DIV). For example:

  <%= will_paginate @posts, :style => 'color:blue' %>

will result in:

  <div class="pagination" style="color:blue"> ... </div>

Source | Google | Stack overflow

Edit

git clone [email protected]:mislav/will_paginate.git

cd will_paginate

open lib/will_paginate/view_helpers.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-WillPaginate--ViewHelpers-will_paginate-for-pr


# Commit to git

git add lib/will_paginate/view_helpers.rbgit commit -m "better docs for WillPaginate::ViewHelpers#will_paginate"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-WillPaginate--ViewHelpers-will_paginate-for-pr

hub pull-request


# Celebrate!