<%# no need for thumbnails unless there is more than one image %>
<% if (@product.images + @product.variant_images).uniq.size > 1 %>
  <ul id="product-thumbnails" class="thumbnails inline" data-hook>
    <% @product.images.each do |i| %>
      <li class='tmb-all tmb-<%= i.viewable.id %>'>
        <%= link_to(image_tag(i.attachment.url(:mini)), i.attachment.url(:product)) %>
      </li>
    <% end %>

    <% if @product.has_variants? %>
      <% @product.variant_images.each do |i| %>
        <% next if @product.images.include?(i) %>
        <li class='vtmb tmb-<%= i.viewable.id %>'>
          <%= link_to(image_tag(i.attachment.url(:mini)), i.attachment.url(:product)) %>
        </li>
      <% end %>
    <% end %>
  </ul>
<% end %>

<%# no need for thumbnails unless there is more than one image %>
<% if @product.gallery.images.size > 1 %>
  <ul id="product-thumbnails" class="thumbnails inline" data-hook>

    <% @product.gallery.images.each do |image| %>
      <% next if image.viewable_id != @product.master.id %>
      <li class='tmb-all tmb-<%= image.viewable_id %>'>
        <%= link_to(image_tag(image.url(:mini)), image.url(:product)) %>
      </li>
    <% end %>

    <% if @product.has_variants? %>
      <% @product.gallery.images.each do |image| %>
        <% next if image.viewable_id == @product.master.id %>
        <li class='vtmb tmb-<%= image.viewable_id %>'>
          <%= link_to(image_tag(image.url(:mini)), image.url(:product)) %>
        </li>
      <% end %>
    <% end %>
  </ul>
<% end %>

Modify product thumbnails for frontend
Modify product thumbnails for frontend

Doing this allows a developer to plug in different galleries for
variants and products and not need to modify existing core models to
change image providers.

This change is motivated by the need to remove the deprecated Paperclip
project from Solidus.

See PR 2337 for more context.
