HTML ERB table container breaks after first few iterations
The filter label div I have on here breaks on the third iteration of product.name
; I'm working with a set of nested tables , and the div essentially ends at iteration #3 and expands the table to full-window width. I've used this css class on other report containers, and this is the first I've seen this issue (only 2 nested tables in those cases). Am I missing anything particularly obvious?
The whole think is inside a <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>
html ruby-on-rails erb bootstrap-sass nested-table
add a comment |
The filter label div I have on here breaks on the third iteration of product.name
; I'm working with a set of nested tables , and the div essentially ends at iteration #3 and expands the table to full-window width. I've used this css class on other report containers, and this is the first I've seen this issue (only 2 nested tables in those cases). Am I missing anything particularly obvious?
The whole think is inside a <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>
html ruby-on-rails erb bootstrap-sass nested-table
Your view code is a real mess, I suggest you first refactor the code and then edit your question. Take into consideration this link 1 and link 2
– John Baker
Nov 23 '18 at 13:56
Ahah, yeah. I borrowed that inner table from another section to include in the thing I was building, but it's...active. It's been scrapped for now in favour of some decent stats and visual brevity. I hadn't looked much into decorators before, but they look pretty relevant. Thanks!
– Boucherie
Nov 23 '18 at 18:01
add a comment |
The filter label div I have on here breaks on the third iteration of product.name
; I'm working with a set of nested tables , and the div essentially ends at iteration #3 and expands the table to full-window width. I've used this css class on other report containers, and this is the first I've seen this issue (only 2 nested tables in those cases). Am I missing anything particularly obvious?
The whole think is inside a <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>
html ruby-on-rails erb bootstrap-sass nested-table
The filter label div I have on here breaks on the third iteration of product.name
; I'm working with a set of nested tables , and the div essentially ends at iteration #3 and expands the table to full-window width. I've used this css class on other report containers, and this is the first I've seen this issue (only 2 nested tables in those cases). Am I missing anything particularly obvious?
The whole think is inside a <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>
html ruby-on-rails erb bootstrap-sass nested-table
html ruby-on-rails erb bootstrap-sass nested-table
edited Nov 22 '18 at 3:50
Boucherie
asked Nov 22 '18 at 3:29
BoucherieBoucherie
315213
315213
Your view code is a real mess, I suggest you first refactor the code and then edit your question. Take into consideration this link 1 and link 2
– John Baker
Nov 23 '18 at 13:56
Ahah, yeah. I borrowed that inner table from another section to include in the thing I was building, but it's...active. It's been scrapped for now in favour of some decent stats and visual brevity. I hadn't looked much into decorators before, but they look pretty relevant. Thanks!
– Boucherie
Nov 23 '18 at 18:01
add a comment |
Your view code is a real mess, I suggest you first refactor the code and then edit your question. Take into consideration this link 1 and link 2
– John Baker
Nov 23 '18 at 13:56
Ahah, yeah. I borrowed that inner table from another section to include in the thing I was building, but it's...active. It's been scrapped for now in favour of some decent stats and visual brevity. I hadn't looked much into decorators before, but they look pretty relevant. Thanks!
– Boucherie
Nov 23 '18 at 18:01
Your view code is a real mess, I suggest you first refactor the code and then edit your question. Take into consideration this link 1 and link 2
– John Baker
Nov 23 '18 at 13:56
Your view code is a real mess, I suggest you first refactor the code and then edit your question. Take into consideration this link 1 and link 2
– John Baker
Nov 23 '18 at 13:56
Ahah, yeah. I borrowed that inner table from another section to include in the thing I was building, but it's...active. It's been scrapped for now in favour of some decent stats and visual brevity. I hadn't looked much into decorators before, but they look pretty relevant. Thanks!
– Boucherie
Nov 23 '18 at 18:01
Ahah, yeah. I borrowed that inner table from another section to include in the thing I was building, but it's...active. It's been scrapped for now in favour of some decent stats and visual brevity. I hadn't looked much into decorators before, but they look pretty relevant. Thanks!
– Boucherie
Nov 23 '18 at 18:01
add a comment |
0
active
oldest
votes
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423463%2fhtml-erb-table-container-breaks-after-first-few-iterations%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423463%2fhtml-erb-table-container-breaks-after-first-few-iterations%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Your view code is a real mess, I suggest you first refactor the code and then edit your question. Take into consideration this link 1 and link 2
– John Baker
Nov 23 '18 at 13:56
Ahah, yeah. I borrowed that inner table from another section to include in the thing I was building, but it's...active. It's been scrapped for now in favour of some decent stats and visual brevity. I hadn't looked much into decorators before, but they look pretty relevant. Thanks!
– Boucherie
Nov 23 '18 at 18:01