Create a new column actions for each rows (product+variant)

This commit is contained in:
Jean-Baptiste Bellet
2023-09-19 14:25:55 +02:00
parent 693d5bad4a
commit 0847f6b0f6
2 changed files with 5 additions and 0 deletions

View File

@@ -21,6 +21,7 @@
%col{ width:"10%" }
%col{ width:"5%" }
%col{ width:"5%", style: "max-width:5em" }
%col{ width:"5%", style: "max-width:5em" }
%thead
%tr
%th.align-left.with-input= t('admin.products_page.columns.name')
@@ -32,6 +33,7 @@
%th.align-left= t('admin.products_page.columns.category')
%th.align-left= t('admin.products_page.columns.tax_category')
%th.align-left= t('admin.products_page.columns.inherits_properties')
%th.align-right= t('admin.products_page.columns.actions')
- products.each do |product|
= form.fields_for("products", product, index: nil) do |product_form|
%tbody.relaxed
@@ -58,6 +60,7 @@
%td.align-left
%td.align-left
.line-clamp-1= product.inherits_properties ? 'YES' : 'NO' #TODO: consider using https://github.com/RST-J/human_attribute_values, else use I18n.t (also below)
%td.align-right
- product.variants.each do |variant|
- prefix = "[products][][variants_attributes][]" # Couldn't convince the formbuilder to generate this for me, so for now we manually add the prefix
= form.fields_for(variant) do |variant_form|
@@ -81,3 +84,4 @@
.line-clamp-1= variant.tax_category&.name || "None" # TODO: convert to dropdown, else translate hardcoded string.
%td.align-left
-# empty
%td.align-right

View File

@@ -550,6 +550,7 @@ en:
tax_category: "Tax Category"
inherits_properties: "Inherits Properties?"
import_date: "Import Date"
actions: Actions
columns_selector:
unit: Unit
price: Price