diff --git a/app/views/admin/order_cycles/_form.html.haml b/app/views/admin/order_cycles/_form.html.haml index dc4a84a9eb..47d49808dc 100644 --- a/app/views/admin/order_cycles/_form.html.haml +++ b/app/views/admin/order_cycles/_form.html.haml @@ -27,11 +27,11 @@ %td{:colspan => 3} .exchange-product{'ng-repeat' => 'product in enterprises[exchange.enterprise_id].supplied_products'} - = check_box_tag 'order_cycle_exchange_{{ $parent.$index }}_exchange_variants_{{ product.master_id }}', 1, 1, 'ng-model' => 'exchange.variants[product.master_id]', 'id' => 'order_cycle_exchange_{{ $parent.$index }}_exchange_variants_{{ product.master_id }}' + = check_box_tag 'order_cycle_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}', 1, 1, 'ng-model' => 'exchange.variants[product.master_id]', 'id' => 'order_cycle_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}' %img{'ng-src' => '{{ product.image_url }}'} {{ product.name }} .exchange-product-variant{'ng-repeat' => 'variant in product.variants'} - = check_box_tag 'order_cycle_exchange_{{ $parent.$parent.$index }}_exchange_variants_{{ variant.id }}', 1, 1, 'ng-model' => 'exchange.variants[variant.id]', 'id' => 'order_cycle_exchange_{{ $parent.$parent.$index }}_exchange_variants_{{ variant.id }}' + = check_box_tag 'order_cycle_exchange_{{ $parent.$parent.$index }}_variants_{{ variant.id }}', 1, 1, 'ng-model' => 'exchange.variants[variant.id]', 'id' => 'order_cycle_exchange_{{ $parent.$parent.$index }}_variants_{{ variant.id }}' {{ variant.label }} = select_tag :new_supplier_id, options_from_collection_for_select(Enterprise.is_primary_producer, :id, :name), {'ng-model' => 'new_supplier_id'} diff --git a/spec/lib/open_food_web/order_cycle_form_applicator_spec.rb b/spec/lib/open_food_web/order_cycle_form_applicator_spec.rb index 903da566bf..275cd2ec78 100644 --- a/spec/lib/open_food_web/order_cycle_form_applicator_spec.rb +++ b/spec/lib/open_food_web/order_cycle_form_applicator_spec.rb @@ -63,7 +63,7 @@ module OpenFoodWeb coordinator_id = 123 supplier_id = 456 - incoming_exchange = {:enterprise_id => supplier_id, :exchange_variants => {'1' => true, '2' => false, '3' => true}} + incoming_exchange = {:enterprise_id => supplier_id, :variants => {'1' => true, '2' => false, '3' => true}} oc = double(:order_cycle, :coordinator_id => coordinator_id, :exchanges => [], :incoming_exchanges => [incoming_exchange]) @@ -81,7 +81,7 @@ module OpenFoodWeb coordinator_id = 123 supplier_id = 456 - incoming_exchange = {:enterprise_id => supplier_id, :exchange_variants => {'1' => true, '2' => false, '3' => true}} + incoming_exchange = {:enterprise_id => supplier_id, :variants => {'1' => true, '2' => false, '3' => true}} oc = double(:order_cycle, :coordinator_id => coordinator_id, diff --git a/spec/requests/admin/order_cycles_spec.rb b/spec/requests/admin/order_cycles_spec.rb index cdccb7c7c0..5201b4abc3 100644 --- a/spec/requests/admin/order_cycles_spec.rb +++ b/spec/requests/admin/order_cycles_spec.rb @@ -53,8 +53,8 @@ feature %q{ select 'My supplier', from: 'new_supplier_id' click_button 'Add supplier' click_button 'Products' - check 'order_cycle_exchange_0_exchange_variants_1' - check 'order_cycle_exchange_0_exchange_variants_3' + check 'order_cycle_exchange_0_variants_1' + check 'order_cycle_exchange_0_variants_3' # And I click Create click_button 'Create' @@ -133,9 +133,9 @@ feature %q{ click_button 'Add supplier' page.all("table.exchanges tr.supplier td.products input").each { |e| e.click } - uncheck "order_cycle_exchange_1_exchange_variants_2" - check "order_cycle_exchange_2_exchange_variants_#{v1.id}" - check "order_cycle_exchange_2_exchange_variants_#{v2.id}" + uncheck "order_cycle_exchange_1_variants_2" + check "order_cycle_exchange_2_variants_#{v1.id}" + check "order_cycle_exchange_2_variants_#{v2.id}" # And I click Update click_button 'Update'