Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding additional data-* attributes break popover #856

Closed
sethvargo opened this issue Dec 27, 2011 · 9 comments
Closed

Adding additional data-* attributes break popover #856

sethvargo opened this issue Dec 27, 2011 · 9 comments

Comments

@sethvargo
Copy link

If I add more data-* attributes (mainly data-method) to a link/button, the popover never loads. This is a problem because Rails will add data-* attributes for certain helpers...

Update

After I looked into the issue a little more, I realized that Rails adds another rel attribute. The issue was actually the jQuery selector (I was only matching entirely instead of partially on the rel attribute). However, I feel like someone could easily run into this issue, so I'm going to leave the issue up.

Essentially if you have something like the following in Rails:

= link_to 'My Link', '#', :method => :put, :rel => 'popover', :title => 'My Title', :data => { :content => 'foobar' }

Rails will automatically add nofollow to your rel tag, which is okay and makes sense. However, if your jQuery selector for popover/twipsy is like the one in the documentation:

$([rel=popover]).popover();

This will fail, because that jQuery selector matches the entire rel attribute. Instead, you should use *= as your selector:

$([rel*=popover].popover();
@shvelo
Copy link

shvelo commented Dec 28, 2011

I miss the good old days when people were writing HTML by hand.

@pokonski
Copy link
Contributor

There's always pure PHP if you wanna time travel :P

@henrikbjorn
Copy link

@pokonski wow, long time since i have seen the obligatory bashing of php from a rails (not ruby) developer

@shvelo
Copy link

shvelo commented Dec 28, 2011

I'm already travelling :D
But i am learning Ruby too.
I just not know why to use Server-side language for Client-side code

@pokonski
Copy link
Contributor

@henrikbjorn obviously it was a joke ;) Of course you have to write your own HTML in Sinatra etc.
@shvelo, generating HTML is not client-side in Rails.

@fat
Copy link
Member

fat commented Jan 2, 2012

closing because this isn't actually an issue - although helpful :)

@fat fat closed this as completed Jan 2, 2012
@sethvargo
Copy link
Author

no problem. Just thought it would be helpful when someone is Googling this (or similar) error in the future :)

@woto
Copy link

woto commented May 5, 2012

Is a bug fixed in current release?
Sorry for bad English

@trante
Copy link

trante commented Jun 17, 2012

That solved for my problem. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants