35 lines
1.4 KiB
Plaintext
35 lines
1.4 KiB
Plaintext
<% if blob.representable? %>
|
|
<figure class="attachment attachment--preview attachment--<%= blob.filename.extension %>">
|
|
<%= render "active_storage/blobs/web/representation", blob: blob %>
|
|
|
|
<figcaption class="attachment__caption">
|
|
<% if caption = blob.try(:caption) %>
|
|
<span><%= caption %></span>
|
|
<% else %>
|
|
<span class="attachment__name"><%= blob.filename %></span>
|
|
<% end %>
|
|
<span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
|
|
<%= link_to rails_blob_path(blob, disposition: :attachment), class: "attachment__file-link", download: blob.filename, title: "Download #{blob.filename}" do %>
|
|
<span>Download</span>
|
|
<% end %>
|
|
</figcaption>
|
|
</figure>
|
|
<% else %>
|
|
<%= link_to rails_blob_path(blob, disposition: :attachment),
|
|
class: "attachment attachment--file attachment--#{blob.filename.extension}",
|
|
download: blob.filename,
|
|
title: "Download #{blob.filename}" do
|
|
%>
|
|
<%= render "active_storage/blobs/web/representation", blob: blob %>
|
|
|
|
<div class="attachment__caption">
|
|
<% if caption = blob.try(:caption) %>
|
|
<span><%= caption %></span>
|
|
<% else %>
|
|
<span class="attachment__name"><%= blob.filename %></span>
|
|
<% end %>
|
|
<span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|