Display text field for variant_unit_name

This commit is contained in:
Rohan Mitchell
2013-12-06 12:06:16 +11:00
parent 3adeed1fa0
commit b21263e1c0
2 changed files with 10 additions and 0 deletions

View File

@@ -50,6 +50,7 @@
%input{ 'ng-model' => 'product.price', 'ofn-decimal' => :true, :name => 'price', 'ofn-track-product' => 'price', :type => 'text' }
%td{ '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', 'ng-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' }

View File

@@ -106,6 +106,15 @@ feature %q{
page.should have_select "variant_unit_with_scale", selected: "Weight (g)"
end
it "displays a text field for the item name when unit is set to 'Items'" do
p = FactoryGirl.create(:product, variant_unit: 'items', variant_unit_scale: nil, variant_unit_name: 'packet')
visit '/admin/products/bulk_edit'
page.should have_select "variant_unit_with_scale", selected: "Items"
page.should have_field "variant_unit_name", with: "packet"
end
end
describe "listing variants" do