mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
committed by
Sigmund Petersen
parent
ed207e3df6
commit
cd63ab63d8
@@ -63,18 +63,17 @@
|
||||
%td.align-right
|
||||
= render partial: 'admin/products_v3/components/product_actions', locals: { product: product }
|
||||
- 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|
|
||||
= form.fields_for("products][][variants_attributes][", variant, index: nil) do |variant_form|
|
||||
%tr.condensed
|
||||
%td.align-left
|
||||
= variant_form.hidden_field :id, name: "#{prefix}[id]"
|
||||
= variant_form.text_field :display_name, name: "#{prefix}[display_name]", 'aria-label': t('admin.products_page.columns.name'), placeholder: product.name
|
||||
= variant_form.hidden_field :id
|
||||
= variant_form.text_field :display_name, 'aria-label': t('admin.products_page.columns.name'), placeholder: product.name
|
||||
%td.align-right
|
||||
= variant_form.text_field :sku, name: "#{prefix}[sku]", 'aria-label': t('admin.products_page.columns.sku')
|
||||
= variant_form.text_field :sku, 'aria-label': t('admin.products_page.columns.sku')
|
||||
%td.align-right
|
||||
.line-clamp-1= variant.unit_to_display
|
||||
%td.align-right
|
||||
= variant_form.text_field :price, name: "#{prefix}[price]", 'aria-label': t('admin.products_page.columns.price'), value: number_to_currency(variant.price, unit: '')&.strip # TODO: add a spec to prove that this formatting is necessary. If so, it should be in a shared form helper for currency inputs
|
||||
= variant_form.text_field :price, 'aria-label': t('admin.products_page.columns.price'), value: number_to_currency(variant.price, unit: '')&.strip # TODO: add a spec to prove that this formatting is necessary. If so, it should be in a shared form helper for currency inputs
|
||||
%td.align-right
|
||||
.line-clamp-1= variant.on_hand || 0 #TODO: spec for this according to requirements.
|
||||
%td.align-left
|
||||
|
||||
Reference in New Issue
Block a user