Sha256: 4de1579852a950190edbe34623bb97faa469b739e7625097af32d9fccae14756

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

<%#
# Image Index Partial

This partial renders an image attribute
to be displayed on a resource's index page.

By default, the attribute is rendered as an image tag.

## Local variables:

- `field`:
  An instance of [Administrate::Field::Image][1].
  A wrapper around the image url pulled from the database.

[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image
%>

<% if field.attached? %>
  <% if field.index_display_preview? %>
    <% if field.many? %>
      <%= render partial: 'fields/active_storage/items',
                 locals: {
                     field: field,
                     variant: field.index_preview_variant,
                     size: field.index_preview_size
                 } %>
    <% else %>
      <%= render partial: 'fields/active_storage/item',
                 locals: {
                     field: field,
                     attachment: field.data,
                     variant: field.index_preview_variant,
                     size: field.index_preview_size
                 } %>
    <% end %>
  <% end %>

  <% if field.index_display_count? %>
    <div class="attachments-count">
      <%= pluralize(field.attachments.count,
                    I18n.t("administrate.fields.active_storage.attachment", default: 'Attachment')
          )
      %>
    </div>
  <% end %>
<% end %>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
administrate-field-active_storage-1.0.1 app/views/fields/active_storage/_index.html.erb
administrate-field-active_storage-1.0.0 app/views/fields/active_storage/_index.html.erb
administrate-field-active_storage-0.4.2 app/views/fields/active_storage/_index.html.erb
administrate-field-active_storage-0.4.1 app/views/fields/active_storage/_index.html.erb
administrate-field-active_storage-0.4.0 app/views/fields/active_storage/_index.html.erb