| Module | Kaminari::ActionViewExtension |
| In: |
lib/kaminari/helpers/action_view_extension.rb
|
A simple "Twitter like" pagination link that creates a link to the next page.
Basic usage:
<%= link_to_next_page @items, 'Next Page' %>
Ajax:
<%= link_to_next_page @items, 'Next Page', :remote => true %>
By default, it renders nothing if there are no more results on the next page. You can customize this output by passing a block.
<%= link_to_next_page @users, 'Next Page' do %>
<span>No More Pages</span>
<% end %>
A simple "Twitter like" pagination link that creates a link to the previous page.
Basic usage:
<%= link_to_previous_page @items, 'Previous Page' %>
Ajax:
<%= link_to_previous_page @items, 'Previous Page', :remote => true %>
By default, it renders nothing if there are no more results on the previous page. You can customize this output by passing a block.
<%= link_to_previous_page @users, 'Previous Page' do %>
<span>At the Beginning</span>
<% end %>
Renders a helpful message with numbers of displayed vs. total entries. Ported from mislav/will_paginate
Basic usage:
<%= page_entries_info @posts %> #-> Displaying posts 6 - 10 of 26 in total
By default, the message will use the humanized class name of objects in collection: for instance, "project types" for ProjectType models. The namespace will be cutted out and only the last name will be used. Override this with the :entry_name parameter:
<%= page_entries_info @posts, :entry_name => 'item' %> #-> Displaying items 6 - 10 of 26 in total
A helper that renders the pagination links.
<%= paginate @articles %>
Renders rel="next" and rel="prev" links to be used in the head.
Basic usage:
In head:
<head>
<title>My Website</title>
<%= yield :head %>
</head>
Somewhere in body:
<% content_for :head do %>
<%= rel_next_prev_link_tags @items %>
<% end %>
#-> <link rel="next" href="/items/page/3" /><link rel="prev" href="/items/page/1" />