Skip to content

Instantly share code, notes, and snippets.

@anndoko
Created June 8, 2017 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anndoko/ca731f754304b48bb62a9bb98615e812 to your computer and use it in GitHub Desktop.
Save anndoko/ca731f754304b48bb62a9bb98615e812 to your computer and use it in GitHub Desktop.
<!-- 商品圖片 -->
<div class="row">
<% if @product_images.present? %>
<!-- 第一張圖為 medium 尺寸大圖 -->
<div class="col-md-12">
<%= image_tag(@product_images.first.image.thumb.url, class: 'main-image') %>
</div>
<% @product_images.each_with_index do |p| %>
<!-- 顯示所有商品圖片 - other 尺寸小圖 -->
<div class="col-md-2 col-sm-4 col-xs-6 image-box">
<%= image_tag(p.image.thumb.url, class: 'list-image') %>
</div>
<% end %>
<% else %>
<%= image_tag('http://placehold.it/300x300&text=No Pic', class: 'thumbnail') %>
<% end %>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment