Simple Tooltip with Ruby on Rails

1st Step

add this code in app/helpers/application_helper.rb

def tooltip(content, options = {}, html_options = {}, *parameters_for_method_reference)
html_options[:title] = options[:tooltip]
html_options[:class] = html_options[:class] || ‘tooltip’
content_tag(“span”, content, html_options)
end

2nd Step

add code in app/views/foo/page.rhtml

3rd Step

add stylesheet in public/stylesheets/yourstyle.css

.mytooltip {
cursor: help;
color: green;
border-bottom: 1px dotted green
}
Originally

http://rafael.adm.br/p/simple-tooltip-helper-for-ruby-on-rails/

Advertisements

One thought on “Simple Tooltip with Ruby on Rails

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s