From 55423d2df1040faf41148cdc18edf44476a50d1a Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Tue, 4 Dec 2012 15:24:11 +1100 Subject: [PATCH] Display all supplied products for selection --- app/views/admin/enterprises/index.rep | 5 +++++ app/views/admin/order_cycles/_form.html.haml | 3 ++- app/views/admin/order_cycles/show.rep | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/views/admin/enterprises/index.rep b/app/views/admin/enterprises/index.rep index 7b78010606..2d22dab0dd 100644 --- a/app/views/admin/enterprises/index.rep +++ b/app/views/admin/enterprises/index.rep @@ -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 diff --git a/app/views/admin/order_cycles/_form.html.haml b/app/views/admin/order_cycles/_form.html.haml index f4ad2aafc6..dbe372ab05 100644 --- a/app/views/admin/order_cycles/_form.html.haml +++ b/app/views/admin/order_cycles/_form.html.haml @@ -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'} diff --git a/app/views/admin/order_cycles/show.rep b/app/views/admin/order_cycles/show.rep index 024358da99..40e1686867 100644 --- a/app/views/admin/order_cycles/show.rep +++ b/app/views/admin/order_cycles/show.rep @@ -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