HTML ERB表容器在前几次迭代后中断

时间:2018-11-22 03:29:36

标签: html ruby-on-rails erb bootstrap-sass nested-table

我在此处使用的过滤器标签div在product.name的第三次迭代中中断;我正在使用一组嵌套表,并且div本质上在迭代#3处结束,并将表扩展为全窗口宽度。我在其他报表容器上使用过此CSS类,这是我第一次看到此问题(在这种情况下,仅2个嵌套表)。我是否缺少特别明显的东西?

整个想法都在<div class="col-md-12 material report">

内部
<div class="filter-label">
    <h2>Report</h2>
    <table class="table table-striped">
        <% @warehoused_products.order(:name).each do |product|%>
        <tr>
            <td><h3><%= product.name%></h3></td>
        </tr>

        <tr>  
            <td>
                <%product.rfid_tags.each do |rfidt| %>
                    <table class="table table-striped" style="margin-bottom: 0px; table-layout: fixed; width:100%">
                    <thead>
                        <% @tag_attributes.each do |attribute| %>          
                        <th scope="col" class="attribute-header">
                        <%= attribute[:label]%></th>
                        <% end %>                                    
                    <thead>

                    <tr>
                        <td style="width: 20%"><%= rfidt.short_number %></td>
                        <td style="width: 20%"><%= humanize_seconds(rfidt.product_selections.sum(:use_time)) %></td>
                    </tr>     
                    <div class="collapse">
                        <% if rfidt.product_selections.empty? %>
                            <h4 class="subtle-header">No Recorded Uses</h4>
                        <% else %>
                        <table class="table table-striped" >
                            <thead>
                                <% @history_attributes.each do |attribute| %>          
                                <th scope="col" class="attribute-header">
                                <%= attribute[:label]%></th>
                                <% end %>                                    
                            <thead>

                            <tbody > 
                                <% rfidt.product_selections.order(created_at: :desc).each do |product_selection| %>
                                    <tr>
                                        <td>
                                        <% if product_selection.try(:rfid_tag) %> 
                                            <%= link_to product_selection.rfid_tag.try(:short_number), [@account, product_selection.rfid_tag], style: 'color: inherit;' %> 
                                        <% elsif RFIDTag.only_deleted.where( id: product_selection.rfid_tag_id ).first %>
                                            <%= RFIDTag.only_deleted.where( id: product_selection.rfid_tag_id ).first.short_number %> [DEL]
                                        <% else %>
                                            N/A
                                        <% end %>
                                        </td>
                                        <td>
                                        <% if product_selection.try(:listing).nil? %>
                                            [Deleted] 
                                        <% else %> 
                                            <%= link_to product_selection.try(:listing).try(:identify), [@account, product_selection.try(:listing)], style: 'color: inherit;' %>
                                        <% end %>
                                        </td>
                                        <td>
                                        <% if product_selection.room_id.present? %>
                                            <% if product_selection.try(:listing).nil? || product_selection.try(:room).nil? %>
                                            [Deleted]
                                            <% else %>
                                            <%= link_to product_selection.try(:room).try(:identify), [@account, product_selection.try(:listing), product_selection.try(:room)], style: 'color: inherit;' %>
                                            <% end %>
                                        <% end %>
                                        </td>
                                        <td>
                                        <%= product_selection.readable_state %>
                                        </td>          
                                        <td>
                                        <% unless product_selection.selected_at == nil %>
                                            <%= Time.zone.at( product_selection.selected_at ).strftime('%l:%M %p on %D') %>
                                        <% end %>
                                        </td>
                                        <td>
                                        <% unless product_selection.staging_at == nil %>
                                            <%= Time.zone.at( product_selection.staging_at ).strftime('%l:%M %p on %D') %>
                                        <% end %>
                                        </td>
                                        <td>
                                        <% unless product_selection.staged_at == nil %>
                                            <%= Time.zone.at( product_selection.staged_at ).strftime('%l:%M %p on %D') %>
                                        <% end %>
                                        </td>
                                        <td>
                                        <% unless product_selection.destaging_at == nil %>
                                            <%= Time.zone.at( product_selection.destaging_at ).strftime('%l:%M %p on %D') %>
                                        <% end %>
                                        </td>
                                        <td>
                                        <% unless product_selection.destaged_at == nil %>
                                            <%= Time.zone.at( product_selection.destaged_at ).strftime('%l:%M %p on %D') %>
                                        <% end %>
                                        </td>
                                        <td>
                                        <%= humanize_seconds(product_selection.use_time) %>
                                        </td>
                                    </tr>
                                <% end %>
                            </tbody>
                        </table>
                        <% end %>
                    </div>
                </table>
            </td>

            </table>

              <% end %>
            </td>
        </tr>
        <%end%>  
    </table> 
</div>

0 个答案:

没有答案