mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
BPE: Do not show product price when product has variants
This commit is contained in:
@@ -122,7 +122,7 @@
|
||||
%input{ 'ng-model' => 'product.master.unit_value_with_description', :name => 'master_unit_value_with_description', 'ofn-track-product' => 'master.unit_value_with_description', :type => 'text', :placeholder => 'value', 'ng-show' => "!hasVariants(product) && hasUnit(product)" }
|
||||
%input{ 'ng-model' => 'product.variant_unit_name', :name => 'variant_unit_name', 'ofn-track-product' => 'variant_unit_name', :placeholder => 'unit', 'ng-show' => "product.variant_unit_with_scale == 'items'", :type => 'text' }
|
||||
%td{ 'ng-show' => 'columns.price.visible' }
|
||||
%input{ 'ng-model' => 'product.price', 'ofn-decimal' => :true, :name => 'price', 'ofn-track-product' => 'price', :type => 'text' }
|
||||
%input{ 'ng-model' => 'product.price', 'ofn-decimal' => :true, :name => 'price', 'ofn-track-product' => 'price', :type => 'text', 'ng-hide' => 'hasVariants(product)' }
|
||||
%td{ 'ng-show' => 'columns.on_hand.visible' }
|
||||
%span{ 'ng-bind' => 'product.on_hand', :name => 'on_hand', 'ng-show' => '!hasOnDemandVariants(product) && (hasVariants(product) || product.on_demand)' }
|
||||
%input.field{ 'ng-model' => 'product.on_hand', :name => 'on_hand', 'ofn-track-product' => 'on_hand', 'ng-hide' => 'hasVariants(product) || product.on_demand', :type => 'number' }
|
||||
|
||||
@@ -85,18 +85,21 @@ feature %q{
|
||||
page.should have_field "available_on", with: p2.available_on.strftime("%F %T")
|
||||
end
|
||||
|
||||
it "displays a price input for each product (ie. for master variant)" do
|
||||
it "displays a price input for each product without variants (ie. for master variant)" do
|
||||
p1 = FactoryGirl.create(:product)
|
||||
p2 = FactoryGirl.create(:product)
|
||||
p1.price = 22.00
|
||||
p2.price = 44.00
|
||||
p1.save!
|
||||
p2.save!
|
||||
p3 = FactoryGirl.create(:product)
|
||||
v = FactoryGirl.create(:variant, product: p3)
|
||||
|
||||
p1.update_attribute :price, 22.0
|
||||
p2.update_attribute :price, 44.0
|
||||
p3.update_attribute :price, 66.0
|
||||
|
||||
visit '/admin/products/bulk_edit'
|
||||
|
||||
page.should have_field "price", with: "22.0"
|
||||
page.should have_field "price", with: "44.0"
|
||||
page.should_not have_field "price", with: "66.0", visible: true
|
||||
end
|
||||
|
||||
it "displays an on hand count input for each product (ie. for master variant) if no regular variants exist" do
|
||||
|
||||
Reference in New Issue
Block a user