Sha256: 583de38bf7d1db89af5ca3be9ff81192c76b78d42c400138902d64004cd5e060

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

<style type="text/css" nonce="<%= content_security_policy_nonce %>">
  #as-field-<%= attachment.id %> {
    width: <%=size[0]/2%>px; 
    height: auto; 
    overflow: hidden;
  }
</style>
<div id="as-field-<%= attachment.id %>">
  <% if attachment.image? %>
    <% if attachment.variable? %>
      <%= image_tag(field.variant(attachment, resize_to_limit: size)) %>
    <% else %>
      <%= image_tag(field.url(attachment)) %>
    <% end %>
  <% elsif attachment.video? %>
    <style type="text/css" nonce="<%= content_security_policy_nonce %>">
      #as-field-video-<%= attachment.id %> {
        object-fit: contain; 
        width: 100%; 
        height: 100%;
      }
    </style>
    <% if attachment.previewable? %>
      <%= video_tag(field.url(attachment),
                    poster: field.preview(attachment, resize_to_limit: size),
                    controls: true,
                    autobuffer: true,
                    id: "as-field-video-#{attachment.id}") %>
    <% else %>
      <%= video_tag(field.url(attachment), controls: true, autobuffer: true, id: "as-field-video-#{attachment.id}") %>
    <% end %>
  <% elsif attachment.audio? %>
    <%= audio_tag(field.url(attachment), autoplay: false, controls: true) %>
  <% elsif attachment.previewable? %>
    <%= image_tag(field.preview(attachment, resize_to_limit: size)) %>
  <% else %>
    <%= attachment.filename %>
  <% end %>
</div>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
administrate-field-active_storage-0.3.8 app/views/fields/active_storage/_preview.html.erb