Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes #10 add :param_name option to the helper

example: <%= paginate @users, :param_name => :pagina %>
  • Loading branch information...
commit f9f529fb68ab89feea38773a4c625c1b14859128 1 parent 0e7a3d8
@amatsuda authored
View
3  lib/kaminari/helpers/action_view_extension.rb
@@ -14,10 +14,11 @@ module InstanceMethods
# * <tt>:left</tt> - The "left outer window" size (1 by default).
# * <tt>:right</tt> - The "right outer window" size (1 by default).
# * <tt>:params</tt> - url_for parameters for the links (:controller, :action, etc.)
+ # * <tt>:param_name</tt> - parameter name for page number in the links (:page by default)
# * <tt>:remote</tt> - Ajax? (false by default)
# * <tt>:ANY_OTHER_VALUES</tt> - Any other hash key & values would be directly passed into each tag as :locals value.
def paginate(scope, options = {}, &block)
- Kaminari::Helpers::PaginationRenderer.new self, options.reverse_merge(:current_page => scope.current_page, :num_pages => scope.num_pages, :per_page => scope.limit_value, :remote => false)
+ Kaminari::Helpers::PaginationRenderer.new self, options.reverse_merge(:current_page => scope.current_page, :num_pages => scope.num_pages, :per_page => scope.limit_value, :param_name => :page, :remote => false)
end
end
end
View
3  lib/kaminari/helpers/tags.rb
@@ -19,6 +19,7 @@ module Helpers
class Tag
def initialize(template, options = {}) #:nodoc:
@template, @options = template, template.options.merge(options)
+ @param_name = @options.delete :param_name
end
def to_s(locals = {}) #:nodoc:
@@ -47,7 +48,7 @@ def find_template
end
def page_url_for(page)
- @template.url_for @template.params.merge(:page => (page <= 1 ? nil : page))
+ @template.url_for @template.params.merge(@param_name => (page <= 1 ? nil : page))
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.