Sha256: 41502b301fa013d19cb82dbd9edef5e4f635e0a803d2acb10ab17801d7acfecb

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

<%
  attachment = form.object
  filename = attachment.blob&.filename&.to_s
  size = number_to_human_size(attachment.blob&.byte_size || 0)
  src = nil
  if attachment.blob
    src = attachment.image? ? url_for(attachment.variant(resize_to_fill: [100, 100])) : url_for(attachment)
  end
%>

<div class="h-form-file-thumbnail media-drag-sort-handle" title="<%= "#{filename} (#{size})" %>" data-media-target="item">
  <%= form.hidden_field(:id) %>
  <%= form.hidden_field(:blob_id) %>
  <%= form.hidden_field(:position, value: attachment.new_record? ? nil : attachment.position) if sort %>
  <%= form.hidden_field(:_destroy) %>

  <a href="<%= url %>" data-turbo-frame="remote_modal" data-media-target="modalButton">
    <%= render 'headmin/thumbnail', src: src, width: 100, height: 100 %>
  </a>

  <div class="h-form-file-thumbnail-actions">
    <!-- Edit -->
    <a href="<%= headmin_media_item_url(id: attachment.blob ? attachment.blob.id : '$1') %>" class="h-form-file-thumbnail-edit" data-turbo-frame="remote_modal" data-media-target="editButton">
      <%= bootstrap_icon('pencil') %>
    </a>

    <!-- Remove -->
    <div class="h-form-file-thumbnail-remove" data-action="click->media#destroy">
      <%= bootstrap_icon('x') %>
    </div>
  </div>
</div>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
headmin-0.5.2 app/views/headmin/forms/media/_item.html.erb