<%# # 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 field.show_in_index? %> <%= render partial: 'fields/active_storage/item', locals: { field: field, attachment: attachments[0], image_size: [50, 50] } %> <% end %> <% if field.index_display_count? %>
<%= pluralize(field.attachments.count, 'Attachment') %>
<% end %> <% else %> 0 Attached files <% end %>