Sha256: 0e0e802150a8abb081d6af39d3daf5c7afa84d3e2f3ceaf9e9a5e2d71254412f

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

<div id="as-field-<%= attachment.id %>">
  <% if attachment.image? %>
    <% if attachment.variable? %>
      <div class="avatar">
        <%#= image_tag attachment.variant(resize_to_limit: image_size)%>
        <%= image_tag(field.variant(attachment, resize_to_limit: size), class:"avatar-img rounded") %>
      </div>
    <% 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

7 entries across 7 versions & 1 rubygems

Version Path
viniBaxter-field-active_storage-300.0.18 app/views/fields/active_storage/normal/_preview.html.erb
viniBaxter-field-active_storage-300.0.17 app/views/fields/active_storage/normal/_preview.html.erb
viniBaxter-field-active_storage-300.0.15 app/views/fields/active_storage/normal/_preview.html.erb
viniBaxter-field-active_storage-300.0.11 app/views/fields/active_storage/normal/_preview.html.erb
viniBaxter-field-active_storage-300.0.10 app/views/fields/active_storage/normal/_preview.html.erb
viniBaxter-field-active_storage-300.0.9 app/views/fields/active_storage/normal/_preview.html.erb
viniBaxter-field-active_storage-300.0.8 app/views/fields/active_storage/normal/_preview.html.erb