Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add documenttion for link_to_previous_page [ci skip]

  • Loading branch information...
commit 2956f8e0641e39e6d95c82e450b2c0fbe60d6e2a 1 parent 5e33369
@yuki24 yuki24 authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 lib/kaminari/helpers/sinatra_helpers.rb
View
17 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
Please sign in to comment.
Something went wrong with that request. Please try again.