14 lines
686 B
Plaintext
14 lines
686 B
Plaintext
<% variant = Attachments::VARIANTS[:small] %>
|
|
<% width = attachment.metadata["width"] %>
|
|
<% height = attachment.metadata["height"] %>
|
|
|
|
<% if attachment.previewable? %>
|
|
<%= image_tag url_for(attachment.preview(variant)), class: "attachment attachment--image", width: width, height: height %>
|
|
<% elsif attachment.variable? %>
|
|
<%= image_tag url_for(attachment.variant(variant)), class: "attachment attachment--image", width: width, height: height %>
|
|
<% else %>
|
|
<div class="attachment attachment--file attachment--<%= attachment.filename.extension -%>">
|
|
<span class="attachment__icon"><%= attachment.filename.extension&.downcase.presence || "unknown" %></span>
|
|
</div>
|
|
<% end %>
|