aboutsummaryrefslogtreecommitdiffstats
path: root/actiontext/app/views/active_storage/blobs/_blob.html.erb
blob: 49ba357dd1d4afc63ac0bae78dbcd1a882df9e9e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
  <% if blob.representable? %>
    <%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
  <% end %>

  <figcaption class="attachment__caption">
    <% if caption = blob.try(:caption) %>
      <%= caption %>
    <% else %>
      <span class="attachment__name"><%= blob.filename %></span>
      <span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
    <% end %>
  </figcaption>
</figure>