2016-02-17 82 views
0

我正在使用Rail 4.2.5和Foundation 6.我試圖關閉一條警報消息,但似乎沒有關閉該順暢效果;這只是一個接近尾聲。原始HTML,這樣的作品,是:Foundation_6提醒消息content_tag

<div class="alert callout" data-closable> 
    <h5>This is Important!</h5> 
    <p>But when you're done reading it, click the close button in the corner to dismiss this alert.</p> 
    <p>I'm using the default <code>data-closable</code> parameters, and simply fade out.</p> 
    <button class="close-button" aria-label="Dismiss alert" type="button" data-close> 
    <span aria-hidden="true">&times;</span> 
    </button> 
</div> 

在我application.html.erb,我想content_tag複製:

<% flash.each do | name, message | %> 
    <%= content_tag :div, class: "#{name} callout", :"data-closable" => "data-closable" do -%> 
    <%= message %> 
    <%= link_to('', html_options = {:"data-label" => "Dismiss alert" , :"data-close" => "data-close" }, class: "close-button") do-%> 
     <span aria-hidden="true">&times;</span> 
    <% end -%> 
    <% end -%> 
<% end -%> 

回答

1

嘗試使用:

<%= content_tag :div, class: "#{name} callout", :data => { :closable => '' } do -%> 
+1

謝謝!全部淡化。 – Sylar