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
}
cursor: help;
color: green;
border-bottom: 1px dotted green
}
Originally
http://rafael.adm.br/p/simple-tooltip-helper-for-ruby-on-rails/
Advertisement
And what should I do to separate the sentence to be shown in many lines?
Te “\n” command and the “*13″ command doesn’t works.
My text of the tooltip is really big, but it isn’t a text itself… It is multiple sentences, witch I want to show each one in one line.
What can I do?
Leia mais: http://rafael.adm.br/p/simple-tooltip-helper-for-ruby-on-rails/comment-page-1/#comment-52195#ixzz10jRxqbox
Please use regexp for that
string.sub(“\n” , ” “)
if it doesn’t work let me know with your example.
Thanks.
It doesn’t works.
It looks like this:
@bla.gsub(“\n” , ” “)},
:class => ‘tooltip’ %>
Sorry, the post cut what I wrote…
@bla.gsub(“\n” , ” “)},
:class => ‘tooltip’ %>
Again -.-
Trying for the last time.
@bla = “Sentence 1
Sentence 2
Sentence 3″
tooltip “Sentences “,
{ :tooltip => @bla.gsub(“\n” , ” “)},
:class => ‘tooltip’
The result of the “gsub” is just to put spaces…
But if in my computer it works, in the computer of the others users of the project may not work…
Don’t need help anymore, tks.
Using css.
Hey ! Bianca
just give me text and let u know solution ..
thanks