Skip to content

Commit

Permalink
Fixed issue with duplicate thumbnails on ProductController#show
Browse files Browse the repository at this point in the history
Fixes #2361
  • Loading branch information
iloveitaly authored and radar committed Jan 2, 2013
1 parent f042ee0 commit 32edfed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
32 changes: 17 additions & 15 deletions core/app/views/spree/products/_thumbnails.html.erb
@@ -1,19 +1,21 @@
<!-- no need for thumnails unless there is more then one image -->
<% if product.images.size > 1 || product.variant_images.size > 0 %>
<%# no need for thumbnails unless there is more then 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" id="tmb-<%= i.id.to_s %>"><%= link_to image_tag(i.attachment.url(:mini)), i.attachment.url(:product) %></li>
<% @product.images.each do |i| %>
<li class='tmb-all' id='tmb-<%= i.id %>'>
<%= link_to(image_tag(i.attachment.url(:mini)), i.attachment.url(:product), :class => 'tmb-all', :id => "tmb-#{i.id}") %>
</li>
<% end %>
<% if @product.has_variants? %>
<% @variants.select(&:available?).each do |v| %>
<% v.images.each do |i| %>
<% next if @product.images.include?(i) %>
<li class='vtmb-<%= v.id %> vtmb' id='tmb-<%= i.id %>'>
<%= link_to(image_tag(i.attachment.url(:mini)), i.attachment.url(:product)) %>
</li>
<% end %>
<% end %>
<% end %>
<% if @product.has_variants?
@variants.each do |v|
if v.available?
v.images.each do |i| %>
<li class="vtmb-<%= v.id.to_s %> vtmb" id="tmb-<%= i.id.to_s %>"><%= link_to image_tag(i.attachment.url(:mini)), i.attachment.url(:product) %></li>
<%
end
end
end
end
%>
</ul>
<% end %>
2 changes: 1 addition & 1 deletion core/app/views/spree/products/show.html.erb
Expand Up @@ -9,7 +9,7 @@
<%= render :partial => 'image' %>
</div>
<div id="thumbnails" data-hook>
<%= render :partial => 'thumbnails', :locals => { :product => @product } %>
<%= render :partial => 'thumbnails' %>
</div>
</div>

Expand Down

0 comments on commit 32edfed

Please sign in to comment.