mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Extract admin order cycle index row into partial
This commit is contained in:
25
app/views/admin/order_cycles/_row.html.haml
Normal file
25
app/views/admin/order_cycles/_row.html.haml
Normal file
@@ -0,0 +1,25 @@
|
||||
- order_cycle = order_cycle_form.object
|
||||
- klass = "order-cycle-#{order_cycle.id} #{order_cycle_status_class order_cycle}"
|
||||
%tr{class: klass}
|
||||
%td= link_to order_cycle.name, main_app.edit_admin_order_cycle_path(order_cycle)
|
||||
%td= order_cycle_form.text_field :orders_open_at, :class => 'datetimepicker', :value => order_cycle.orders_open_at
|
||||
%td= order_cycle_form.text_field :orders_close_at, :class => 'datetimepicker', :value => order_cycle.orders_close_at
|
||||
%td.suppliers
|
||||
- order_cycle.suppliers.managed_by(spree_current_user).each do |s|
|
||||
= s.name
|
||||
%br/
|
||||
%td= order_cycle.coordinator.name
|
||||
%td.distributors
|
||||
- order_cycle.distributors.managed_by(spree_current_user).each do |d|
|
||||
= d.name
|
||||
%br/
|
||||
|
||||
%td.products
|
||||
- variant_images = capture do
|
||||
- order_cycle.variants.each do |v|
|
||||
= image_tag(v.images.first.attachment.url(:mini)) if v.images.present?
|
||||
%br/
|
||||
%span.with-tip{'data-powertip' => variant_images}= "#{order_cycle.variants.count} variants"
|
||||
|
||||
%td.actions
|
||||
= link_to '', main_app.clone_admin_order_cycle_path(order_cycle), class: 'clone-order-cycle icon-copy no-text'
|
||||
@@ -18,6 +18,7 @@
|
||||
%col
|
||||
%col
|
||||
%col
|
||||
|
||||
%thead
|
||||
%tr
|
||||
%th Name
|
||||
@@ -28,31 +29,9 @@
|
||||
%th Distributors
|
||||
%th Products
|
||||
%th.actions
|
||||
|
||||
%tbody
|
||||
= f.fields_for :collection do |order_cycle_form|
|
||||
- order_cycle = order_cycle_form.object
|
||||
- klass = "order-cycle-#{order_cycle.id} #{order_cycle_status_class order_cycle}"
|
||||
%tr{class: klass}
|
||||
%td= link_to order_cycle.name, main_app.edit_admin_order_cycle_path(order_cycle)
|
||||
%td= order_cycle_form.text_field :orders_open_at, :class => 'datetimepicker', :value => order_cycle.orders_open_at
|
||||
%td= order_cycle_form.text_field :orders_close_at, :class => 'datetimepicker', :value => order_cycle.orders_close_at
|
||||
%td.suppliers
|
||||
- order_cycle.suppliers.managed_by(spree_current_user).each do |s|
|
||||
= s.name
|
||||
%br/
|
||||
%td= order_cycle.coordinator.name
|
||||
%td.distributors
|
||||
- order_cycle.distributors.managed_by(spree_current_user).each do |d|
|
||||
= d.name
|
||||
%br/
|
||||
= render 'admin/order_cycles/row', order_cycle_form: order_cycle_form
|
||||
|
||||
%td.products
|
||||
- variant_images = capture do
|
||||
- order_cycle.variants.each do |v|
|
||||
= image_tag(v.images.first.attachment.url(:mini)) if v.images.present?
|
||||
%br/
|
||||
%span.with-tip{'data-powertip' => variant_images}= "#{order_cycle.variants.count} variants"
|
||||
|
||||
%td.actions
|
||||
= link_to '', main_app.clone_admin_order_cycle_path(order_cycle), class: 'clone-order-cycle icon-copy no-text'
|
||||
= f.submit 'Update'
|
||||
|
||||
Reference in New Issue
Block a user