mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Stop using master variant for storing :display_as value
(cherry picked from commit 8c0b8dad85)
This commit is contained in:
@@ -76,11 +76,11 @@ module Spree
|
||||
}
|
||||
|
||||
delegate_belongs_to :master, :images, :sku, :unit_value, :unit_description
|
||||
delegate :images_attributes=, :display_as=, to: :master
|
||||
delegate :images_attributes=, to: :master
|
||||
|
||||
# Transient attribute used temporarily when creating a new product,
|
||||
# this value is persisted on the product's variant
|
||||
attr_accessor :price
|
||||
# Transient attributes used temporarily when creating a new product,
|
||||
# these values are persisted on the product's variant
|
||||
attr_accessor :price, :display_as
|
||||
|
||||
after_create :set_master_variant_defaults
|
||||
after_save :save_master
|
||||
@@ -395,6 +395,7 @@ module Spree
|
||||
variant.product = self
|
||||
variant.is_master = false
|
||||
variant.price = price
|
||||
variant.display_as = display_as
|
||||
variants << variant
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.six.columns.omega{ "ng-if" => "product.variant_unit_with_scale != 'items'" }
|
||||
= f.field_container :display_as do
|
||||
= f.label :product_display_as, t('.display_as')
|
||||
%input#product_display_as.fullwidth{name: "product[display_as]", placeholder: "{{ placeholder_text }}", type: "text", value: @product.master.display_as}
|
||||
%input#product_display_as.fullwidth{name: "product[display_as]", placeholder: "{{ placeholder_text }}", type: "text", value: @product.display_as}
|
||||
|
||||
Reference in New Issue
Block a user