I haven't tried it yet but to add a 'data-popup' attribute try using <%= link_to h(link_str ||= "Click to add"), edit_comment_path(cart_item), :method => :get, 'data-popup' => true %>
On Mon, Feb 14, 2011 at 12:52 PM, Dan Sadaka <[email protected]> wrote: > Greetings, > > I am trying to implement a popup window that will contain the output of > a method called by a link_to tag. > > I am using Rails 3 with jQuery and have read that :popup => true no > longer works. > > I have also read a post that said... > > # --- Start of Post > Another option is to use the Rails 3 unobtrusive way of event > delegating those links: > > - Add an attribute "data-popup" to your link_to if you want it to open > in a new window > > With the jquery adapter, add to application.js inside the document > ready handler: > > $('a[data-popup]').live('click', function(e) { > window.open($(this).href); > e.preventDefault(); > }); > #--- End of post > > I do not know how to "Add an attribute" to my link_to tag. I have tried > :class => "data-popup" and > :name => "data-popup" (and $('a[name=data-popup]').live ... > > and many other combinations. Using firebug, I've determined that the > jQuery function never gets called when I click the link. > > The latest version of my link_to tag looks like: > > <%= link_to h(link_str ||= "Click to add"), > edit_comment_path(cart_item), :method => :get, :name => "data-popup" %> > > Has anyone done this? > > If so, I am anxiously awaiting your reply... > > THANK YOU IN ADVANCE, > Dan > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

