From 385a80a3052be443729d924f0f11ef291e032cfe Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Fri, 6 Dec 2013 14:38:46 +1100 Subject: [PATCH] Revert "Can set variant_unit_name when unit type is not items" - this applies to a different field. This reverts commit 8f6f37355ca1b6b670cd74e36adedc3a357b232f. --- app/views/spree/admin/products/bulk_edit.html.haml | 2 +- spec/features/admin/bulk_product_update_spec.rb | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/views/spree/admin/products/bulk_edit.html.haml b/app/views/spree/admin/products/bulk_edit.html.haml index 9efa219b5c..692d3445ed 100644 --- a/app/views/spree/admin/products/bulk_edit.html.haml +++ b/app/views/spree/admin/products/bulk_edit.html.haml @@ -50,7 +50,7 @@ %input{ 'ng-model' => 'product.price', 'ofn-decimal' => :true, :name => 'price', 'ofn-track-product' => 'price', :type => 'text' } %td.unit{ 'ng-show' => 'columns.unit.visible' } %select.select2{ 'ng-model' => 'product.variant_unit_with_scale', :name => 'variant_unit_with_scale', 'ofn-track-product' => 'variant_unit_with_scale', 'ng-options' => 'unit[1] as unit[0] for unit in variant_unit_options' } - %input{ 'ng-model' => 'product.variant_unit_name', :name => 'variant_unit_name', 'ofn-track-product' => 'variant_unit_name', :type => 'text' } + %input{ 'ng-model' => 'product.variant_unit_name', :name => 'variant_unit_name', 'ofn-track-product' => 'variant_unit_name', 'ng-show' => "product.variant_unit_with_scale == 'items'", :type => 'text' } %td{ 'ng-show' => 'columns.on_hand.visible' } %span{ 'ng-bind' => 'product.on_hand', :name => 'on_hand', 'ng-show' => 'hasVariants(product)' } %input.field{ 'ng-model' => 'product.on_hand', :name => 'on_hand', 'ofn-track-product' => 'on_hand', 'ng-show' => '!hasVariants(product)', :type => 'number' } diff --git a/spec/features/admin/bulk_product_update_spec.rb b/spec/features/admin/bulk_product_update_spec.rb index 3766b5fd26..bad0bf2f0a 100644 --- a/spec/features/admin/bulk_product_update_spec.rb +++ b/spec/features/admin/bulk_product_update_spec.rb @@ -189,7 +189,7 @@ feature %q{ scenario "updating a product with no variants (except master)" do s1 = FactoryGirl.create(:supplier_enterprise) s2 = FactoryGirl.create(:supplier_enterprise) - p = FactoryGirl.create(:product, supplier: s1, available_on: Date.today, variant_unit: 'volume', variant_unit_scale: 1, variant_unit_name: '(foo)') + p = FactoryGirl.create(:product, supplier: s1, available_on: Date.today, variant_unit: 'volume', variant_unit_scale: 1) p.price = 10.0 p.on_hand = 6; p.save! @@ -203,7 +203,6 @@ feature %q{ page.should have_field "available_on", with: p.available_on.strftime("%F %T") page.should have_field "price", with: "10.0" page.should have_select "variant_unit_with_scale", selected: "Volume (L)" - page.should have_field "variant_unit_name", with: "(foo)" page.should have_field "on_hand", with: "6" fill_in "product_name", with: "Big Bag Of Potatoes" @@ -211,7 +210,6 @@ feature %q{ fill_in "available_on", with: (Date.today-3).strftime("%F %T") fill_in "price", with: "20" select "Weight (kg)", from: "variant_unit_with_scale" - fill_in "variant_unit_name", with: "(bar)" fill_in "on_hand", with: "18" click_button 'Update' @@ -224,7 +222,6 @@ feature %q{ page.should have_field "available_on", with: (Date.today-3).strftime("%F %T") page.should have_field "price", with: "20.0" page.should have_select "variant_unit_with_scale", selected: "Weight (kg)" - page.should have_field "variant_unit_name", with: "(bar)" page.should have_field "on_hand", with: "18" end