Sha256: a6a79c0155fa1947cd216177ba112af44d16ff0889b2fcdaf84e333724d8361a

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 KB

Contents

<% removable = local_assigns.fetch(:removable, false)
  image_size = local_assigns.fetch(:image_size, [1920, 1080]) %>
<% if attachment.image? and attachment.variable? and !field.url_only? %>
  <div class="avatar avatar-lg">
    <%= image_tag attachment.variant(resize: "400x400"), class:"avatar-img rounded" %>
  </div>
<% elsif attachment.image? and !field.url_only? %>
  <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
    <%= image_tag(field.url(attachment)) %>
  <% end %>
<% elsif attachment.video? and attachment.previewable? and !field.url_only? %> <%# if ffmpeg is installed %>
  <%= video_tag(field.url(attachment), poster: field.preview(attachment, resize_to_limit: image_size), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
<% elsif attachment.video? and !field.url_only? %>
  <%= video_tag(field.url(attachment), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
<% elsif attachment.audio? and !field.url_only? %>
  <%= audio_tag(field.url(attachment), autoplay: false, controls: true) %>
<% else %>
  <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
    <% if attachment.previewable? and !field.url_only? %>
      <%= image_tag(field.preview(attachment, resize_to_limit: [595, 842])) %>
    <% else %>
      <%= attachment.filename %>
    <% end %>
  <% end %>
<% end %>
<% if removable %>
  <%#= link_to 'Remove', field.destroy_path(field, attachment), method: :delete, class: 'remove-attachment-link' %>
  <%= link_to 'Remove', destroy_url, 
      method: :delete, 
      # data: { confirm: t("administrate.actions.confirm") },
      remote: true, 
      class: 'remove-attachment-link'
       %>
  <hr>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
viniBaxter-field-active_storage-11.0.1 app/views/fields/active_storage/_item.html.erb
viniBaxter-field-active_storage-11.0.0 app/views/fields/active_storage/_item.html.erb