Simplify field naming

This commit is contained in:
Rohan Mitchell
2013-01-10 15:33:56 +11:00
parent 4e78fa19a3
commit e46d61075e
3 changed files with 9 additions and 9 deletions

View File

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

View File

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

View File

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