527ffc42b9
Skipping API responses, where we need absolute URLs, and those that are intended for sharing or external use: - account/join_codes/show.html.erb - Join code URL for sharing - boards/edit/_publication.html.erb - Publication URL for sharing - public/* views - Public page URLs and og:url meta tags - pwa/manifest.json.erb - PWA manifest needs absolute URLs For this, we had to replace `url_for` used with Active Storage variants and previews with the specific path helper (for Active Storage representations).
26 lines
1.1 KiB
Plaintext
26 lines
1.1 KiB
Plaintext
<% variant = Attachments::VARIANTS[local_assigns[:in_gallery] ? :small : :large] %>
|
|
<% width = blob.metadata["width"] %>
|
|
<% height = blob.metadata["height"] %>
|
|
|
|
<% if blob.video? %>
|
|
<%= tag.video \
|
|
src: rails_blob_path(blob),
|
|
controls: true,
|
|
preload: :none,
|
|
style: "aspect-ratio: #{width} / #{height};",
|
|
width: width,
|
|
height: height %>
|
|
<% elsif blob.audio? %>
|
|
<audio controls="true" width="100%" preload="metadata">
|
|
<source src="<%= rails_blob_path(blob) %>" type="<%= blob.content_type %>">
|
|
</audio>
|
|
<% elsif blob.variable? %>
|
|
<%= link_to rails_representation_path(blob.variant(variant)), data: { lightbox_target: "image", lightbox_caption_value: blob.filename.to_s } do %>
|
|
<%= image_tag rails_representation_path(blob.variant(variant)), width: width, height: height %>
|
|
<% end %>
|
|
<% elsif blob.previewable? %>
|
|
<%= image_tag rails_representation_path(blob.preview(variant)), width: width, height: height %>
|
|
<% else %>
|
|
<span class="attachment__icon"><%= blob.filename.extension&.downcase.presence || "unknown" %></span>
|
|
<% end %>
|