Files
fizzy/app/views/active_storage/blobs/web/_representation.html.erb
T
Jorge Manrubia 4aa1cef99d Show previeable content in the editor
Embedded PDF previewing isnt' reliable (not working in Safari with active storage). Instead
let's align the editor with Active Storage previews and support pdf previews
2025-05-27 12:30:44 +02:00

22 lines
725 B
Plaintext

<% size = local_assigns[:in_gallery] ? [800, 600] : [1024, 768] %>
<% if blob.video? %>
<%= tag.video \
src: rails_blob_path(blob),
controls: true,
preload: :none,
width: "100%", height: "100%" %>
<% elsif blob.audio? %>
<audio controls="true" width="100%" preload="metadata">
<source src="<%= rails_blob_url(blob) %>" type="<%= blob.content_type %>">
</audio>
<% elsif blob.variable? %>
<%= image_tag url_for(blob.variant(loader: { n: -1 }, resize_to_limit: size)) %>
<% elsif blob.previewable? %>
<%= image_tag url_for(blob.preview(resize_to_limit: size)) %>
<% else %>
<div class="attachment__figure">
<%= file_extension_for(blob) %>
</div>
<% end %>