Frage

I can not render the html placed inside my yml file as data attribute of a generic popover . I'm going to render the text field in this way:

= f.text_field :link_url, :class => "span6 popoverable", :data => {:content => t("popover.campaign.link_url.message"), :original_title => t("popover.campaign.link_url.title")}, :placeholder => "URL link to your song, fan page, site"

and in yml file I have:

en:
  popover:
    campaign:
      link_url:
        message: "Description.<br><b>Example:</b> <i>http://yoursite.com/</i>"
        title: "Title"

but the output is not the html code but the plain versione containing the html tag.

I tried with raw and .html_safe but i always get the same result.

t(:string).html_safe
raw(t(:string))

How can i fix this? Thank you

War es hilfreich?

Lösung

Did you try setting the :html => true option on the Bootstrap .popover? http://twitter.github.io/bootstrap/javascript.html#popovers

Andere Tipps

You do the same via sanitizing the content. Please go this documentation : http://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html

may be this would help you.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top