Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added option :ajax for remote page links #133

Closed
wants to merge 1 commit into from

4 participants

Ace Suares Ryan Bates Mohith Thimmaiah Mislav Marohnić
Ace Suares
  • Added an option :ajax => true, that will add the data-remote attribute to the page links
Ace Suares

I see this is a dupe of #100

Ryan Bates

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

Ace Suares

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

Bryan Larsen bryanlarsen referenced this pull request from a commit in bryanlarsen/will_paginate
Bryan Larsen 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
Bryan Larsen bryanlarsen referenced this pull request from a commit in bryanlarsen/will_paginate
Bryan Larsen 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
Mohith 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

Ace Suares

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....

Mohith Thimmaiah
Ace Suares

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

Mohith Thimmaiah
Mislav Marohnić
Owner

See #100

Mislav Marohnić 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
3  lib/will_paginate/view_helpers/link_renderer.rb
View
@@ -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.