Display all supplied products for selection

This commit is contained in:
Rohan Mitchell
2012-12-04 15:24:11 +11:00
parent e9746ebc9b
commit 55423d2df1
3 changed files with 8 additions and 1 deletions

View File

@@ -1,4 +1,9 @@
r.list_of :enterprises, @collection do
r.element :id
r.element :name
r.list_of :supplied_products do |product|
r.element :name
r.element :image_url, product.images.present? ? product.images.first.attachment.url(:mini) : nil
end
end

View File

@@ -25,7 +25,8 @@
%td= f.submit 'Products', 'ng-click' => 'toggleProducts($event, exchange)'
%tr.products{'ng-show' => 'exchange.showProducts'}
%td{:colspan => 3}
.exchange-product{'ng-repeat' => 'product in exchange.exchange_products'}
.exchange-product{'ng-repeat' => 'product in enterprises[exchange.enterprise_id].supplied_products'}
%img{'ng-src' => '{{ product.image_url }}'}
{{ product.name }}
= select_tag :new_supplier_id, options_from_collection_for_select(Enterprise.is_primary_producer, :id, :name), {'ng-model' => 'new_supplier_id'}

View File

@@ -10,6 +10,7 @@ r.element :order_cycle, @order_cycle do
r.list_of :exchange_products do |product, exchange_variants|
r.element :id, product.id
r.element :name, product.name
r.element :image_url, product.images.first.attachment.url(:mini)
r.list_of :variants, exchange_variants.map { |ev| VariantPresenter.new(ev.variant) } do
r.element :id
r.element :image_url