Reputation: 133
I am trying to implement the tooltip functionality as shown here: http://twitter.github.com/bootstrap/javascript.html#tooltips using the Bootstrap-sass gem for Ruby on Rails 3. I have done the following below but it doesn't work (text doesn't appear when I hover over text):
In gem file:
gem 'bootstrap-sass', '2.1'
In application.js:
//= require bootstrap
In show.js.erb:
$('#example').tooltip(options);
And in show.html.erb:
<a href="#" id="example" title="first tooltip" data-placement="right">
hover over me</a>
Why doesn't this work?
application.js:
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require_tree .
views/layouts/application.html.erb:
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js?ver=1.4.0"></script>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<%= yield %>
<%= render 'layouts/footer' %>
<%= debug(params) if Rails.env.development? %>
</div>
</body>
</html>
Gem file:
source 'https://rubygems.org'
gem 'rails', '3.2.7'
gem 'bootstrap-sass', '2.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'jquery-rails'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
group :development do
gem 'annotate', '2.5.0'
end
Upvotes: 3
Views: 3862
Reputation: 654
You needed this:
// Loads all Bootstrap javascripts
//= require bootstrap
from https://github.com/thomas-mcdonald/bootstrap-sass
Upvotes: 2