lib/kaminari/helpers/action_view_extension.rb in kaminari-0.15.0 vs lib/kaminari/helpers/action_view_extension.rb in kaminari-0.15.1

- old
+ new

@@ -13,11 +13,11 @@ # * <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) - paginator = Kaminari::Helpers::Paginator.new self, options.reverse_merge(:current_page => scope.current_page, :total_pages => scope.total_pages, :per_page => scope.limit_value, :param_name => Kaminari.config.param_name, :remote => false) + paginator = Kaminari::Helpers::Paginator.new self, options.reverse_merge(:current_page => scope.current_page, :total_pages => scope.total_pages, :per_page => scope.limit_value, :remote => false) paginator.to_s end # A simple "Twitter like" pagination link that creates a link to the previous page. # @@ -132,17 +132,17 @@ output = "" if !scope.first_page? && !scope.last_page? # If not first and not last, then output both links. - output << '<link rel="next" href="' + url_for(params.merge(param_name => (scope.current_page + 1))) + '"/>' - output << '<link rel="prev" href="' + url_for(params.merge(param_name => (scope.current_page - 1))) + '"/>' + output << '<link rel="next" href="' + url_for(params.merge(param_name => (scope.current_page + 1), :only_path => true)) + '"/>' + output << '<link rel="prev" href="' + url_for(params.merge(param_name => (scope.current_page - 1), :only_path => true)) + '"/>' elsif scope.first_page? # If first page, add next link unless last page. - output << '<link rel="next" href="' + url_for(params.merge(param_name => (scope.current_page + 1))) + '"/>' unless scope.last_page? + output << '<link rel="next" href="' + url_for(params.merge(param_name => (scope.current_page + 1), :only_path => true)) + '"/>' unless scope.last_page? else # If last page, add prev link unless first page. - output << '<link rel="prev" href="' + url_for(params.merge(param_name => (scope.current_page - 1))) + '"/>' unless scope.first_page? + output << '<link rel="prev" href="' + url_for(params.merge(param_name => (scope.current_page - 1), :only_path => true)) + '"/>' unless scope.first_page? end output.html_safe end end