带有 content_tag 的 Foundation 6 警报消息

Foundation 6 alert message with content_tag

我正在使用 Rail 4.2.5 和 Foundation 6。我正在尝试关闭警报消息,但似乎没有以那种平滑的效果关闭;这只是一个急剧的关闭。有效的原始 html 是:

<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 -%>

尝试使用:

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