README.rdoc in kaminari-0.15.1 vs README.rdoc in kaminari-0.16.0
- old
+ new
@@ -1,6 +1,6 @@
-= Kaminari {<img src="https://travis-ci.org/amatsuda/kaminari.png"/>}[http://travis-ci.org/amatsuda/kaminari] {<img src="https://codeclimate.com/github/amatsuda/kaminari.png" />}[https://codeclimate.com/github/amatsuda/kaminari]
+= Kaminari {<img src="https://travis-ci.org/amatsuda/kaminari.svg"/>}[http://travis-ci.org/amatsuda/kaminari] {<img src="https://img.shields.io/codeclimate/github/amatsuda/kaminari.svg" />}[https://codeclimate.com/github/amatsuda/kaminari] {<img src="http://inch-ci.org/github/amatsuda/kaminari.svg" alt="Inline docs" />}[http://inch-ci.org/github/amatsuda/kaminari]
A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for modern web app frameworks and ORMs
== Features
@@ -25,13 +25,13 @@
The pagination helper outputs the HTML5 <nav> tag by default. Plus, the helper supports Rails 3 unobtrusive Ajax.
== Supported versions
-* Ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1 (trunk)
+* Ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1.1
-* Rails 3.0.x, 3.1, 3.2, 4.0, 4.1 (edge)
+* Rails 3.0, 3.1, 3.2, 4.0, 4.1
* Haml 3+
* Mongoid 2+
@@ -77,10 +77,11 @@
=== General configuration options
You can configure the following default values by overriding these values using <tt>Kaminari.configure</tt> method.
default_per_page # 25 by default
max_per_page # nil by default
+ max_pages # nil by default
window # 4 by default
outer_window # 0 by default
left # 0 by default
right # 0 by default
page_method_name # :page by default
@@ -165,10 +166,15 @@
* Ajax links (crazy simple, but works perfectly!)
<%= paginate @users, :remote => true %>
This would add <tt>data-remote="true"</tt> to all the links inside.
+* specifying an alternative views directory (default is <tt>kaminari/</tt>)
+
+ <%= paginate @users, :views_prefix => 'templates/' %>
+ This would search for partials in <tt>app/views/templates/kaminari</tt>. This option makes it easier to do things like A/B testing pagination templates/themes, using new/old templates at the same time as well as better intergration with other gems sush as {cells}[https://github.com/apotonick/cells].
+
* the +link_to_next_page+ and +link_to_previous_page+ helper method
<%= link_to_next_page @items, 'Next Page' %>
This simply renders a link to the next page. This would be helpful for creating a Twitter-like pagination feature.
@@ -187,11 +193,20 @@
pagination:
first: "« First"
last: "Last »"
previous: "‹ Prev"
next: "Next ›"
- truncate: "..."
+ truncate: "…"
+ helpers:
+ page_entries_info:
+ one_page:
+ display_entries:
+ zero: "No %{entry_name} found"
+ one: "Displaying <b>1</b> %{entry_name}"
+ other: "Displaying <b>all %{count}</b> %{entry_name}"
+ more_pages:
+ display_entries: "Displaying %{entry_name} <b>%{first} - %{last}</b> of <b>%{total}</b> in total"
=== Customizing the pagination helper
Kaminari includes a handy template generator.
@@ -239,13 +254,15 @@
=== Paginating a generic Array object
Kaminari provides an Array wrapper class that adapts a generic Array object to the <tt>paginate</tt> view helper.
However, the <tt>paginate</tt> helper doesn't automatically handle your Array object (this is intentional and by design).
<tt>Kaminari::paginate_array</tt> method converts your Array object into a paginatable Array that accepts <tt>page</tt> method.
- Kaminari.paginate_array(my_array_object).page(params[:page]).per(10)
+ @paginatable_array = Kaminari.paginate_array(my_array_object).page(params[:page]).per(10)
+
You can specify the +total_count+ value through options Hash. This would be helpful when handling an Array-ish object that has a different +count+ value from actual +count+ such as RSolr search result or when you need to generate a custom pagination. For example:
- Kaminari.paginate_array([], total_count: 145).page(params[:page]).per(10)
+
+ @paginatable_array = Kaminari.paginate_array([], total_count: 145).page(params[:page]).per(10)
== Creating friendly URLs and caching
Because of the +page+ parameter and Rails 3 routing, you can easily generate SEO and user-friendly URLs. For any resource you'd like to paginate, just add the following to your +routes.rb+: