Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added option :ajax for remote page links #133

Closed
wants to merge 1 commit into from

4 participants

@acesuares
  • Added an option :ajax => true, that will add the data-remote attribute to the page links
@acesuares

I see this is a dupe of #100

@ryanb

I prefer calling this option :remote like in issue #100 to stay consistent with Rails built-in helper methods (link_to, form_for, etc.).

@acesuares

iAgree. I hadn't seen issue #100 but it's a way better symbol. +1 for :remote

@bryanlarsen bryanlarsen referenced this pull request from a commit in bryanlarsen/will_paginate
@bryanlarsen bryanlarsen add extra_attributes option that adds extra attributes to links.
This is a generalization of of issue #133.  Not all ajax frameworks
work the same was as rails ujs.
9f711f1
@bryanlarsen bryanlarsen referenced this pull request from a commit in bryanlarsen/will_paginate
@bryanlarsen bryanlarsen add extra_attributes option that adds extra attributes to links.
This is a generalization of of issue #133.  Not all ajax frameworks
work the same was as rails ujs.
f36aaa4
@thimmaiah

I cant seem to use this any longer. :remote=>false or :ajax=>false does not seem to work.

My code snippet below
= will_paginate @deals, :remote=>false

@acesuares

thim... no clue. I made my fork to make :remote => true work, but if I don't specify :remote, it's not using data-remote in the links....

@thimmaiah
@acesuares

Are you sure? I thought it was the other way around, in the master no links are ajax links... what line of code makes all links ajax links? can you look it up for me? I couldn't find any mention of the word remote (grep -ir remote will_paginate/*)

Cheers
ace

@thimmaiah
@mislav
Owner

See #100

@mislav mislav closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 29, 2011
  1. * Added an option :ajax => true, that will add the data-remote attri…

    Ace Suares authored
    …bute
    
       to the page links
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 0 deletions.
  1. +3 −0  lib/will_paginate/view_helpers/link_renderer.rb
View
3  lib/will_paginate/view_helpers/link_renderer.rb
@@ -92,6 +92,9 @@ def link(text, target, attributes = {})
target = url(target)
end
attributes[:href] = target
+ if @options[:ajax]
+ attributes["data-remote"] = true
+ end
tag(:a, text, attributes)
end
Something went wrong with that request. Please try again.