Sha256: ab147bd1c760c479233dc9f77abaeefc22fbe31428871dff35dc61fc7c80fe99

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 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
%>
<style>
  <%# figure out a way to remove this %>
   td img {
       max-height: unset !important;
   }
</style>
<%
  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? %>
    <div class="attachments-count">
      <%= pluralize(field.attachments.count, 'Attachment') %>
    </div>
  <% end %>
<% else %>
  0 Attached files
<% end %>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
viniBaxter-field-active_storage-9.0.0 app/views/fields/active_storage/_index.html.erb
viniBaxter-field-active_storage-8.0.0 app/views/fields/active_storage/_index.html.erb
viniBaxter-field-active_storage-7.0.0 app/views/fields/active_storage/_index.html.erb
viniBaxter-field-active_storage-6.0.0 app/views/fields/active_storage/_index.html.erb
viniBaxter-field-active_storage-5.0.0 app/views/fields/active_storage/_index.html.erb