<% imageable.images.each do |image| %>
  <div class="thumbnail col-sm-4">
    <a href="<%= image.url %>">
      <img src="<%= image.url(w: 150) %>">
    </a>

    <% if user_signed_in? && (current_user.owns?(imageable) || current_user.admin?) %>
      <div class="image-controls pull-right">
        <% if image == imageable.cover_image %>
          cover
        <% else %>
          <%= link_to "make cover", image_path(image, cover: true), method: :patch %>
        <% end %>
        |
        <%= link_to image_tag("delete"), image_path(image), method: :delete %>
      </div>
    <% end %>
    <div class="clearfix"></div>
  </div>
<% end %>
<%
  parent = { parent_type: imageable.class, parent_id: imageable.id }
  imageable.images.each do |image| %>
  <div class="thumbnail col-sm-4">
    <a href="<%= image.url %>">
      <img src="<%= image.url(w: 150) %>">
    </a>

    <% if user_signed_in? && (current_user.owns?(imageable) || current_user.admin?) %>
      <div class="image-controls pull-right">
        <% if image == imageable.cover_image %>
          cover
        <% else %>
          <%= link_to "make cover", image_path(image, parent.merge(cover: true)), method: :patch %>
        <% end %>
        |
        <%= link_to image_tag("delete"), image_path(image, parent), method: :delete %>
      </div>
    <% end %>
    <div class="clearfix"></div>
  </div>
<% end %>
Fix image deletion and cover-making.
Fix image deletion and cover-making.
