Sha256: f8b41c599a6c31d0af6d35b41ce9eb69256ccf0115e034bffb0981740090eccc
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
<%# # Item Partial This partial renders attached items. Attachments of type image, video and audio are emedded. For all other types we try use it's preview. If all else fails we simply link to the attached file. This partial will optionally show a `remove` link next to each attachment which is controlled via a boolean local variable. ## Local variables: - `field`: An instance of [Administrate::Field::Image]. A wrapper around the image url pulled from the database. - `attachment`: Reference to the file - `size`: [x, y] Maximum size of the ActiveStorage preview. %> <% if field.show_display_preview? && attachment.persisted? %> <div> <%= render partial: 'fields/active_storage/preview', locals: local_assigns %> </div> <% end %> <% if attachment.persisted? %> <div> <%= link_to attachment.filename, field.blob_url(attachment), title: attachment.filename %> </div> <% end %> <% if field.destroy_url.present? %> <% destroy_url = field.destroy_url.call(namespace, field.data.record, attachment) %> <div> <%= link_to I18n.t("administrate.fields.active_storage.remove", default: 'Remove'), destroy_url, method: :delete, class: 'remove-attachment-link', data: { confirm: t("administrate.actions.confirm") } %> </div> <hr> <% end %>
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
administrate-field-active_storage-1.0.1 | app/views/fields/active_storage/_item.html.erb |
administrate-field-active_storage-1.0.0 | app/views/fields/active_storage/_item.html.erb |