Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fix no responsive scroll for add_stock table

Matthew Kennedy0d9395e74795
diff --git a/backend/app/views/spree/admin/products/stock.html.erb b/backend/app/views/spree/admin/products/stock.html.erb
index 45bdd107b1..b360853d8c 100644
--- a/backend/app/views/spree/admin/products/stock.html.erb
+++ b/backend/app/views/spree/admin/products/stock.html.erb
@@ -6,73 +6,74 @@
<%= render 'add_stock_form' %>
</div>
<% end %>
-
-<div class="card mb-3 table-responsive">
- <table class="table" id="listing_product_stock">
- <thead>
- <tr data-hook="admin_product_stock_management_index_headers">
- <th colspan="2"><%= Spree.t(:variant) %></th>
- <th colspan="3"><%= Spree.t(:stock_location_info) %></th>
- </tr>
- </thead>
- <tbody>
- <% @variants.each do |variant| %>
- <% if variant.stock_items.present? %>
- <tr id="<%= spree_dom_id variant %>" data-hook="admin_product_stock_management_index_rows">
- <td class="image text-center">
- <% if variant.images.present? %>
- <%= image_tag main_app.url_for(variant.images.first.url(:mini)) %>
- <% end %>
- </td>
- <td>
- <%= variant.sku_and_options_text %>
- <%= form_tag admin_product_variants_including_master_path(@product, variant, format: :js), method: :put, class: 'toggle_variant_track_inventory' do %>
- <div class="checkbox">
- <%= label_tag "track_inventory_#{ variant.id }" do %>
- <%= check_box_tag 'track_inventory', 1, variant.track_inventory?,
- class: 'track_inventory_checkbox', id: "track_inventory_#{ variant.id }" %>
- <%= Spree.t(:track_inventory) %>
- <%= hidden_field_tag 'variant[track_inventory]', variant.track_inventory?,
- class: 'variant_track_inventory',
- id: "variant_track_inventory_#{variant.id}" %>
- <% end %>
- </div>
- <% end if can?(:update, @product) && can?(:update, variant) %>
- </td>
-
- <td colspan="3" class="stock_location_info">
- <table class="table table-bordered mb-0">
- <thead>
- <th><%= Spree.t(:stock_location) %></th>
- <th class="text-center"><%= Spree.t(:count_on_hand) %></th>
- <th class="text-center"><%= Spree.t(:backorderable) %></th>
- <th class="actions text-center"></th>
- </thead>
- <tbody>
- <% variant.stock_items.each do |item| %>
- <% next unless @stock_locations.include?(item.stock_location) %>
- <tr id="stock-item-<%= item.id %>">
- <td><%= item.stock_location.name %></td>
- <td class="text-center"><%= item.count_on_hand %></td>
- <td class="text-center">
- <%= form_tag admin_stock_item_path(item), method: :put, class: 'toggle_stock_item_backorderable' do %>
- <%= check_box_tag 'stock_item[backorderable]', true,
- item.backorderable?,
- class: 'stock_item_backorderable',
- id: "stock_item_backorderable_#{item.stock_location.id}" %>
- <% end if can? :update, item %>
- </td>
- <td class="actions actions-1 text-center">
- <%= link_to_with_icon('delete.svg', Spree.t(:remove), [:admin, item], method: :delete, remote: true, class: 'icon_link btn btn-danger btn-sm', data: { action: :remove, confirm: Spree.t(:are_you_sure) }, no_text: true) if can? :destroy, item %>
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
- </td>
- <% end %>
+<div class="card mb-3 ">
+ <div class="table-responsive">
+ <table class="table" id="listing_product_stock">
+ <thead>
+ <tr data-hook="admin_product_stock_management_index_headers">
+ <th colspan="2"><%= Spree.t(:variant) %></th>
+ <th colspan="3"><%= Spree.t(:stock_location_info) %></th>
</tr>
- <% end %>
- </tbody>
- </table>
+ </thead>
+ <tbody>
+ <% @variants.each do |variant| %>
+ <% if variant.stock_items.present? %>
+ <tr id="<%= spree_dom_id variant %>" data-hook="admin_product_stock_management_index_rows">
+ <td class="image text-center">
+ <% if variant.images.present? %>
+ <%= image_tag main_app.url_for(variant.images.first.url(:mini)) %>
+ <% end %>
+ </td>
+ <td>
+ <%= variant.sku_and_options_text %>
+ <%= form_tag admin_product_variants_including_master_path(@product, variant, format: :js), method: :put, class: 'toggle_variant_track_inventory' do %>
+ <div class="checkbox">
+ <%= label_tag "track_inventory_#{ variant.id }" do %>
+ <%= check_box_tag 'track_inventory', 1, variant.track_inventory?,
+ class: 'track_inventory_checkbox', id: "track_inventory_#{ variant.id }" %>
+ <%= Spree.t(:track_inventory) %>
+ <%= hidden_field_tag 'variant[track_inventory]', variant.track_inventory?,
+ class: 'variant_track_inventory',
+ id: "variant_track_inventory_#{variant.id}" %>
+ <% end %>
+ </div>
+ <% end if can?(:update, @product) && can?(:update, variant) %>
+ </td>
+
+ <td colspan="3" class="stock_location_info">
+ <table class="table table-bordered mb-0">
+ <thead>
+ <th><%= Spree.t(:stock_location) %></th>
+ <th class="text-center"><%= Spree.t(:count_on_hand) %></th>
+ <th class="text-center"><%= Spree.t(:backorderable) %></th>
+ <th class="actions text-center"></th>
+ </thead>
+ <tbody>
+ <% variant.stock_items.each do |item| %>
+ <% next unless @stock_locations.include?(item.stock_location) %>
+ <tr id="stock-item-<%= item.id %>">
+ <td><%= item.stock_location.name %></td>
+ <td class="text-center"><%= item.count_on_hand %></td>
+ <td class="text-center">
+ <%= form_tag admin_stock_item_path(item), method: :put, class: 'toggle_stock_item_backorderable' do %>
+ <%= check_box_tag 'stock_item[backorderable]', true,
+ item.backorderable?,
+ class: 'stock_item_backorderable',
+ id: "stock_item_backorderable_#{item.stock_location.id}" %>
+ <% end if can? :update, item %>
+ </td>
+ <td class="actions actions-1 text-center">
+ <%= link_to_with_icon('delete.svg', Spree.t(:remove), [:admin, item], method: :delete, remote: true, class: 'icon_link btn btn-danger btn-sm', data: { action: :remove, confirm: Spree.t(:are_you_sure) }, no_text: true) if can? :destroy, item %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </td>
+ <% end %>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
</div>