Distributors and products displayed on edit

This commit is contained in:
Rohan Mitchell
2013-01-18 11:59:32 +11:00
parent 0a2ce30bb6
commit 33b9d45f43
3 changed files with 17 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
%td.active= check_box_tag 'order_cycle_exchange_{{ $index }}_active', 1, 1, 'ng-model' => 'exchange.active', 'id' => 'order_cycle_exchange_{{ $index }}_active'
%td.supplier_name {{ enterprises[exchange.enterprise_id].name }}
%td{:class => "#{type}_name"} {{ enterprises[exchange.enterprise_id].name }}
%td.products
= f.submit 'Products', 'ng-click' => 'toggleProducts($event, exchange)'
{{ exchangeSelectedVariants(exchange) }} / {{ enterpriseTotalVariants(enterprises[exchange.enterprise_id]) }} selected

View File

@@ -20,7 +20,7 @@
%th Products
%tbody{'ng-repeat' => 'exchange in order_cycle.incoming_exchanges'}
%tr.supplier
= render 'exchange_form', :f => f
= render 'exchange_form', :f => f, :type => 'supplier'
%tr.products{'ng-show' => 'exchange.showProducts'}
= render 'exchange_supplied_products_form'
@@ -41,7 +41,7 @@
%th Products
%tbody{'ng-repeat' => 'exchange in order_cycle.outgoing_exchanges'}
%tr.distributor
= render 'exchange_form', :f => f
= render 'exchange_form', :f => f, :type => 'distributor'
%tr.products{'ng-show' => 'exchange.showProducts'}
= render 'exchange_distributed_products_form'

View File

@@ -108,7 +108,20 @@ feature %q{
page.all('table.exchanges tbody tr.supplier').each do |row|
row.find('td.products input').click
products_row = page.find('table.exchanges tr.products')
products_row = page.all('table.exchanges tr.products').select { |r| r.visible? }.first
products_row.should have_selector "input[type='checkbox'][checked='checked']"
row.find('td.products input').click
end
# And I should see the distributors with products
page.should have_selector 'td.distributor_name', :text => oc.distributors.first.name
page.should have_selector 'td.distributor_name', :text => oc.distributors.last.name
page.all('table.exchanges tbody tr.distributor').each do |row|
row.find('td.products input').click
products_row = page.all('table.exchanges tr.products').select { |r| r.visible? }.first
products_row.should have_selector "input[type='checkbox'][checked='checked']"
row.find('td.products input').click