hyperrjas
hyperrjas

Reputation: 10744

render html code inside tooltip partial

I'm using http://twitter.github.com/bootstrap/javascript.html#tooltips on a app.

I have this rails code:

<%= link_to t('.shipping_details'), "#", :rel => "tooltip",  :title => "#{render 'orders/partials/shipping_cost_detail', :o => o}"  %>

The problem is that I can't render html code inside of _shipping_cost_detail.html.erb

For example If I add a <div></div> or <br> is visible like text on tooltip.

How can I render html inside of tooltip?

Upvotes: 2

Views: 2202

Answers (2)

Sachin R
Sachin R

Reputation: 11876

Use html_safe option, I think it will solve ur problem

<%= link_to t('.shipping_details'), "#", :rel => "tooltip",  :title => "#{render 'orders/partials/shipping_cost_detail', :o => o}".html_safe  %>

Upvotes: 1

Rory McCrossan
Rory McCrossan

Reputation: 337626

When you are initialising the tooltip there is a html property, which specifies whether you are inserting text or html. By default this is false - you need to set it to true.

Something like this:

$('.shipping_details').tooltip({
     html: true,
     // other options...
});

Upvotes: 5

Related Questions