2024-08-29 17:30:23 +02:00
|
|
|
<% if blob.representable? %>
|
|
|
|
<% representation = blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
|
|
|
|
<% if representation.image&.attached? || representation.key.present? %>
|
|
|
|
<figure class="attachment attachment--preview attachment--<%= blob.filename.extension %>">
|
|
|
|
<%= image_tag representation %>
|
2019-04-09 15:44:36 +02:00
|
|
|
<% else %>
|
2024-08-29 17:30:23 +02:00
|
|
|
<figure class="attachment attachment--file attachment--<%= blob.filename.extension %>">
|
|
|
|
<%= image_tag blob %>
|
2019-04-09 15:44:36 +02:00
|
|
|
<% end %>
|
2024-08-29 17:30:23 +02:00
|
|
|
</figure>
|
|
|
|
<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>
|
|
|
|
<% end %>
|