indentlabs/notebook

View on GitHub
app/views/content/form/images/_gallery.html.erb

Summary

Maintainability
Test Coverage
<%# todo: some smart resizing for 1-3+ images %>
<%# todo: lightbox on click %>

<div id="gallery_panel" class="panel">
  <div class="center">
    <% images = content.image_uploads %>
    <% images.each do |image| %>
      <%= link_to image.src(:original), class: 'z-depth-1 hoverable', target: '_new' do %>
        <%= image_tag image.src(images.count == 1 ? :hero : :medium), style: 'max-width: 100%' %>
      <% end %>
    <% end %>
  </div>

  <% if @basil_images.any? %>
    <div class="center">
      <% @basil_images.each do |commission| %>
        <%= link_to commission.image, class: 'z-depth-1 hoverable', target: '_new' do %>
          <%= image_tag commission.image, style: 'max-width: 100%' %>
        <% end %>
      <% end %>
    </div>
  <% end %>
</div>