Files
openfoodnetwork/app/views/spree/admin/images/index.html.haml
Luis Ramos 072da7316e Remove views code that tests for the existence of product variants
A product always has the standard variant, the only case where a product will not have variants is immediatly after creation and before being saved
2020-06-01 14:09:14 +01:00

41 lines
1.5 KiB
Plaintext

= render partial: 'spree/admin/shared/product_sub_menu'
= render partial: 'spree/admin/shared/product_tabs', locals: { current: 'Images'}
- content_for :page_actions do
%li= link_to_with_icon('icon-plus', t('spree.new_image'), new_admin_product_image_url(@product), id: 'new_image_link', class: 'button')
#images
- unless @product.images.any? || @product.variant_images.any?
.no-objects-found
= t('spree.no_images_found')
\.
- else
%table.index.sortable{ "data-sortable-link" => "#{update_positions_admin_product_images_url(@product)}" }
%colgroup
%col{ style: "width: 5%" }/
%col{ style: "width: 10%" }/
%col{ style: "width: 25%" }/
%col{ style: "width: 45%" }/
%col{ style: "width: 15%" }/
%thead
%tr
%th{:colspan => "2"}= t('spree.thumbnail')
%th= Spree::Variant.model_name.human
%th= t('spree.alt_text')
%th.actions
%tbody
- (@product.variant_images).each do |image|
- tr_class = cycle('odd', 'even')
- tr_id = spree_dom_id(image)
%tr{class: tr_class, id: tr_id }
%td.no-border
%span.handle
%td
= link_to image_tag(image.attachment.url(:mini)), image.attachment.url(:product)
%td= options_text_for(image)
%td= image.alt
%td.actions
= link_to_with_icon 'icon-edit', t('spree.edit'), edit_admin_product_image_url(@product, image), no_text: true, data: { action: 'edit'}
= link_to_delete image, { url: admin_product_image_url(@product, image), no_text: true }