Module | WillPaginate::ViewHelpers::Base |
In: |
lib/will_paginate/view_helpers/base.rb
|
This is the base module which provides the will_paginate view helper.
Renders a helpful message with numbers of displayed vs. total entries. You can use this as a blueprint for your own, similar helpers.
<%= 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. Override this to your liking with the :entry_name parameter:
<%= page_entries_info @posts, :entry_name => 'item' %> #-> Displaying items 6 - 10 of 26 in total
Entry name is entered in singular and pluralized with String#pluralize method from ActiveSupport. If it isn‘t loaded, specify plural with :plural_name parameter:
<%= page_entries_info @posts, :entry_name => 'item', :plural_name => 'items' %>
By default, this method produces HTML output. You can trigger plain text output by passing :html => false in options.
Renders Digg/Flickr-style pagination for a WillPaginate::Collection object. Nil is returned if there is only one page in total; pagination links aren‘t needed in that case.
All options beside listed ones are passed as HTML attributes to the container element for pagination links (the DIV). For example:
<%= will_paginate @posts, :id => 'wp_posts' %>
… will result in:
<div class="pagination" id="wp_posts"> ... </div>