seyhunak / twitter-bootstrap-rails

Twitter Bootstrap for Rails 6.0, Rails 5 - Rails 4.x Asset Pipeline
https://github.com/seyhunak/twitter-bootstrap-rails
4.49k stars 997 forks source link

Popover not working for me. #450

Closed victorbstan closed 10 years ago

victorbstan commented 11 years ago
// I type this in Chrome console
$("a[rel=popover]").popover();
TypeError: Cannot call method '_init' of undefined

<a rel="popover" data-content="url hello hello" data-original-title="a title" data-trigger="click" data-placement="below" class="btn btn-small" href="#">Link to calendar</a>

//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require moment
//= require angular
//= require angular-sanitize
//= require schedule/schedule
//= require schedule/controllers
//= require_tree .

jQuery ->
  $("a[rel=popover]").popover()
  $(".tooltip").tooltip()
  $("a[rel=tooltip]").tooltip()
davidray commented 11 years ago

I'm having the same issue.

danieldocki commented 11 years ago

+1 popover not working

twitter-bootstrap-rails 2.1.9

<a href="#" data-content="Pizza Description" data-original-title="Pizza" rel="popover">Pizza</a>
$("a[rel=popover]").popover(
 placement: "bottom",
 trigger: "hover"
)
chewmanfoo commented 11 years ago

same issue here. From the inspector:

$('a[rel="popover"]')
[
<a href=​"#" rel=​"popover" class=​"test_class" data-content=​"popover content" data-title=​"popover title">​click​</a>​
, 
<a href=​"#" rel=​"popover" class=​"test_class" data-content=​"popover content" data-title=​"popover title" data-trigger=​"hover">​hover​</a>​
]
$('a[rel="popover"]').popover()
TypeError: Cannot call method '_init' of undefined
FinnMacCool commented 11 years ago

+1 with this problem. using bootstrap-sass 2.2.2.0 and sass-rails 3.2.5

line 540 in jquery-ui.js

instance.option( options || {} )._init();

seems to be the culprit.

ItsGenis commented 11 years ago

Same problem here :(

chewmanfoo commented 11 years ago

doesn't the docs for twitter bootstrap specify that you must include the popover and tooltip api's manually to get them to work? Here's what it says:

"For performance reasons, the tooltip and popover data-apis are opt in, meaning you must initialize them yourself."

here: http://twitter.github.com/bootstrap/javascript.html#tooltips

victorbstan, you don't appear to be doing this. Has anyone else tried it?

FinnMacCool commented 11 years ago

well, i do have the lines

<script src="/assets/bootstrap-tooltip.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-popover.js?body=1" type="text/javascript"></script>

in the source code of the page in question. or do they mean something else by initializiing?

emckay commented 11 years ago

Also having the same problem. @chewmanfoo I believe that by default twitter-bootstrap-rails includes all the bootstrap plugins when you have the line //= require twitter/bootstrap in your manifest

rdeshpande commented 11 years ago

I had the same error - it ended up being a conflict with ActiveAdmin's JS. When I removed AA's scripts the popover worked again.

FinnMacCool commented 11 years ago

@rdeshpande that solved it. thank you.

chewmanfoo commented 11 years ago

rdeshpande - sorry to be sush a noob, but how exactly did you surgically remove active admin from your rails app? Just remove it from the Gemfile and do bundle update?

rdeshpande commented 11 years ago

@chewmanfoo that works if you don't need activeadmin - they are separate gems so you could surely remove it. However, if you need ActiveAdmin you would remove it from your application.js (or wherever it's being required) and then only use it in your ActiveAdmin layouts.

FinnMacCool commented 11 years ago

@chewmanfoo i did it (mostly) following this explanation.

toadkicker commented 11 years ago

Can you check that your application.js looks something like this one:

https://github.com/toadkicker/teststrap/blob/master/app/assets/javascripts/application.js

chewmanfoo commented 11 years ago

I'm happy to report that it works fine now after removing the active_admin js from my assets