Files
openfoodnetwork/app/views/spree/admin/images/index.html.haml
2022-06-01 17:16:55 +10:00

43 lines
1.8 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, @url_filters), 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, @url_filters)}" }
%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
- # A Rails bug makes it necessary to call `main_app.url_for` here.
- # https://github.com/rails/rails/issues/31325
= link_to image_tag(main_app.url_for(image.variant(:mini))), main_app.url_for(image.variant(: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, @url_filters), no_text: true, data: { action: 'edit'}
= link_to_delete image, { url: admin_product_image_url(@product, image, @url_filters), no_text: true }