Sha256: 8234a3da3ba7bfd67608bc1887ff00049cb10df8eab9b204022c3259208055b7
Contents?: true
Size: 1.97 KB
Versions: 6
Compression:
Stored size: 1.97 KB
Contents
<!-- no need for thumnails unless there is more then one image --> <% if product.images.size > 1 %> <ul id="product-thumbnails" class="thumbnails"> <% product.images.each do |i| %> <li><%= link_to(image_tag(i.attachment.url(:mini)), i.attachment.url(:product)) %></li> <% end %> </ul> <% end %> <% if @product.has_variants? has_checked = false %> <h4 id="variant-images"><%= t('images_for') %>: <%= @selected_variant.options_text %></h4> <ul id="variant-thumbnails" class="thumbnails"> <% product.variants.each do |v| checked = !has_checked && (v.available?) has_checked = true if checked if checked v.images.each do |i| %> <li><%= link_to(image_tag(i.attachment.url(:mini)), i.attachment.url(:product)) %></li> <% end %> <% end %> <% end %> </ul> <% end %> <% content_for :head do %> <script type="text/javascript" charset="utf-8"> var images = new Array(); <% product.variants.each do |v| %> images[<%= v.id.to_s %>] = new Array(); <% v.images.each_with_index do |image, i| %> images[<%= v.id.to_s %>][<%= i %>] = '<%= image.attachment.url(:mini) %>'; <% end %> <% end %> var add_image_handlers = function(){ $("#main-image").data('selectedThumb', $('#main-image img').attr('src')); $('ul.thumbnails li').eq(0).addClass('selected'); $('ul.thumbnails li a').click(function() { $("#main-image").data('selectedThumb', $(this).attr('href')); $('ul.thumbnails li').removeClass('selected'); $(this).parent('li').addClass('selected'); return false; }).hover( function() { $('#main-image img').attr('src', $(this).attr('href').replace('mini', 'product')); }, function() { $('#main-image img').attr('src', $("#main-image").data('selectedThumb')); } ); }; jQuery(document).ready(function(){ add_image_handlers(); }); </script> <% end %>
Version data entries
6 entries across 6 versions & 2 rubygems