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

<%
  raw_model = content.is_a?(ContentSerializer) ? content.raw_model : content
%>

<% raw_model.image_uploads.each do |image| %>
  <div class="row">
    <div class="col s12 m3">
      <%= link_to image.src(:original), class: 'z-depth-1 hoverable right', target: '_new' do %>
        <%= image_tag image.src(:small) %>
      <% end %>
    </div>
    <div class="col s12 m9">
      <h5>
        Uploaded image
        <small class="grey-text">
          <%= Filesize.from("#{image.src_file_size}B").to_f('KB').round(2) %> KB
        </small>
      </h5>
      <div>
        <%= link_to 'Open', image.src(:original), class: 'btn white black-text', target: '_new' %>
        <%= link_to 'Delete', image_deletion_path(image.id),
          class: 'btn white black-text js-remove-image',
          method: 'delete',
          remote: true,
          data: { confirm: "Are you sure? This can't be undone." } %>
      </div>
    </div>
  </div>
<% end %>
