Permalink
Browse files

Add documenttion for link_to_previous_page [ci skip]

  • Loading branch information...
1 parent 5e33369 commit 2956f8e0641e39e6d95c82e450b2c0fbe60d6e2a Yuki Nishijima committed Feb 2, 2014
Showing with 17 additions and 0 deletions.
  1. +17 −0 lib/kaminari/helpers/sinatra_helpers.rb
@@ -93,6 +93,23 @@ def paginate(scope, options = {}, &block)
paginator.to_s
end
+ # A simple "Twitter like" pagination link that creates a link to the previous page.
+ # Works on Sinatra.
+ #
+ # ==== Examples
+ # 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 parameter <tt>:placeholder</tt>.
+ #
+ # <%= link_to_previous_page @users, 'Previous Page', :placeholder => %{<span>At the Beginning</span>} %>
+ #
def link_to_previous_page(scope, name, options = {})
params = options.delete(:params) || (Rack::Utils.parse_query(env['QUERY_STRING']).symbolize_keys rescue {})
param_name = options.delete(:param_name) || Kaminari.config.param_name

0 comments on commit 2956f8e

Please sign in to comment.