mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Display text field for variant_unit_name
This commit is contained in:
@@ -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' }
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user