BPE: Do not show product price when product has variants

This commit is contained in:
Rohan Mitchell
2014-03-05 15:08:54 +11:00
parent 07d979b38f
commit b89c84e8bd
2 changed files with 9 additions and 6 deletions

View File

@@ -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' }

View File

@@ -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