demarches-normaliennes/app/views/active_storage/blobs/_blob.html.erb

20 lines
865 B
Text
Raw Normal View History

<% 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 %>
<figure class="attachment attachment--file attachment--<%= blob.filename.extension %>">
<%= image_tag blob %>
2019-04-09 15:44:36 +02:00
<% end %>
</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 %>