= 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%" }/
      - if @product.has_variants?
        %col{ style: "width: 25%" }/
      %col{ style: "width: 45%" }/
      %col{ style: "width: 15%" }/
    %thead
      %tr
        %th{:colspan => "2"}= t('spree.thumbnail')
        - if @product.has_variants?
          %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)
          - if @product.has_variants?
            %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 }
