简体   繁体   中英

Ruby On Rails - 'image_tag' with 'do' does not work

I am trying to create my image as a block, but it's not working ... The app doesn't read the code inside the block :

<%= image_tag("house-toiture.jpg") do %>
    <%= puts "COME ON DUDE" %>
<% end %>

I want to add the following information inside :

<% @operation_presenter.works.each do |work| %>
     <!-- (<%= work.travaux %>) -->
    <button type="button" data-container="body" data-toggle="popover" data-trigger="hover" data-placement="top" data-html="true" title="<%= work.nom_travaux %>" data-content="travaux : <%= work.travaux %><br />
    Cout travaux : <%= work.cout_travaux %>€<br />
    TVA : <%= work.tva_travaux %>%"><%= work.nom_travaux %></button>
<% end %>

The idea is to add popover on the image.

Someone has an idea where comes from the issue ?

Thank you very much !

HTML <img> tags cannot have children, so this doesn't make sense.

To add popups, you need some JavaScript (or very nifty CSS with hidden checkboxes). If you don't want to write that yourself, use something like Bootstrap popups .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM