我在他們的頁面上顯示客戶的資產,以及每個存在的3個資產,我想將它們包裝在<div class="row"></div>
中。如何在Rails和Foundation中爲每3條記錄插入一個新的div?
現在我有這個在我看來:
<% if @assets.empty? %>
<h3>You don't have any uploaded images.</h3>
<% else %>
<% for asset in @assets %>
<% assetcount += 1 %>
<div class="large-4 columns assetColumn text-center">
<a href="#" class="asset-toolbar"><%= image_tag asset.file_name.url(:thumb).to_s %></a>
<div id="asset-toolbar-options<%= assetcount %>" style="display: none;">
<a href="#" data-reveal-id="myModal<%= assetcount %>" data-reveal><span data-tooltip class="has-top tip-top radius" title="Enlarge Image"><i class="icon-zoom-in"></i></span></a>
<%= link_to [current_customer, asset], method: :delete do %>
<span data-tooltip class="has-top tip-top radius" title="Delete Image"><i class="icon-remove"></i></span>
<% end %>
</div>
<div id="myModal<%= assetcount %>" class="reveal-modal" data-reveal>
<%= image_tag asset.file_name.to_s %>
</div>
</div>
<% end %>
<% end %>
我嘗試使用split_each(3)
但它完全搞砸了我的佈局。然後我試着用assetcount
來跟蹤它是心靈爆炸:(