Permalink
Browse files

added support for remote links markup with :remote => true

  • Loading branch information...
1 parent 260c1c4 commit df4ab5ec10dffc74424dfbd16465b7a34126964d @dcrec1 committed Jan 24, 2011
Showing with 8 additions and 1 deletion.
  1. +2 −1 lib/will_paginate/view_helpers.rb
  2. +6 −0 test/view_test.rb
@@ -56,6 +56,7 @@ module ViewHelpers
# * <tt>:id</tt> -- HTML ID for the container (default: nil). Pass +true+ to have the ID
# automatically generated from the class name of objects in collection: for example, paginating
# ArticleComment models would yield an ID of "article_comments_pagination".
+ # * <tt>:remote</tt> -- sets to true the data-remote or remote attribute, depending of the inplementation of link_to
#
# Advanced options:
# * <tt>:param_name</tt> -- parameter name for page number in URLs (default: <tt>:page</tt>)
@@ -302,7 +303,7 @@ def page_link_or_span(page, span_class, text = nil)
if page and page != current_page
classnames = span_class && span_class.index(' ') && span_class.split(' ', 2).last
- page_link page, text, :rel => rel_value(page), :class => classnames
+ page_link page, text, :rel => rel_value(page), :class => classnames, :remote => @options[:remote]
else
page_span page, text, :class => span_class
end
View
@@ -297,6 +297,12 @@ def test_complex_custom_page_param
end
end
+ def test_remote_links
+ paginate({}, :remote => true) do
+ assert_select 'a[remote=true]', 3
+ end
+ end
+
def test_custom_routing_page_param
@request.symbolized_path_parameters.update :controller => 'dummy', :action => nil
paginate :per_page => 2 do

0 comments on commit df4ab5e

Please sign in to comment.