Sha256: 5f0f31c21be55fb6f822d27c65ec3394c08694c2dc7f20db2ed464fe6d40f6c8

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

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
%>
<%
  attachments = Array(field.many? ? field.attachments : field.data)
%>

  <% if field.attached? %>

    <% if attachments.count > 1 %>
        <%= pluralize(attachments.count, 'Attached file') %>
      <% else %>
          <% field.attachments.each do |attachment| %>
              <%= render :partial => 'fields/active_storage/item_index', locals: { field: field, attachment: attachment } %>
              <br/>
          <% end %>
    <% end %>
    <% else %>
    0 Attached files
  <% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
worker-field-active_storage-0.2.0 app/views/fields/active_storage/_index.html.erb
worker-field-active_storage-0.1.0 app/views/fields/active_storage/_index.html.erb