Sha256: 0d78631ba2810b031243a33049ade7e6b6c42464fc14a7d7df9bb74b6076db70

Contents?: true

Size: 1.28 KB

Versions: 11

Compression:

Stored size: 1.28 KB

Contents

<%#
# Image Form Partial

This partial renders an input element for image attributes.
By default, the input is a text field for the image's URL.

## Local variables:

- `f`:
  A Rails form generator, used to help create the appropriate input fields.
- `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
%>
<div class="field-unit__label">
  <%= f.label field.attribute %>
</div>
<div class="field-unit__field">
  <% if field.drop_js? %>
    <!-- Form dropJS -->
    <%= render partial: 'fields/active_storage/dropjs_items', locals: { f: f, field: field, removable: field.destroyable? } %>
  <%else %>
    <!-- Form if no dropJS -->
    <%= f.file_field field.attribute, multiple: field.many?, direct_upload: field.direct? %>
  <%end %>
  <!-- show previous images recorded -->
  <% if field.attached?  %>
    <% if !field.drop_js? %>
      <%= render partial: 'fields/active_storage/items', locals: { field: field, removable: field.destroyable? } %>
      <%= field.can_add_attachment? ? "Add:" : "Replace:" %>
    <%else %>
      <%= render partial: 'fields/active_storage/items', locals: { field: field, removable: field.destroyable? } %>
    <%end %>
  <% end %>
</div>

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
viniBaxter-field-active_storage-14.0.0 app/views/fields/active_storage/_form.html.erb
viniBaxter-field-active_storage-12.0.0 app/views/fields/active_storage/_form.html.erb
viniBaxter-field-active_storage-11.0.2 app/views/fields/active_storage/_form.html.erb
viniBaxter-field-active_storage-11.0.1 app/views/fields/active_storage/_form.html.erb
viniBaxter-field-active_storage-11.0.0 app/views/fields/active_storage/_form.html.erb
viniBaxter-field-active_storage-10.0.0 app/views/fields/active_storage/_form.html.erb
viniBaxter-field-active_storage-9.0.0 app/views/fields/active_storage/_form.html.erb
viniBaxter-field-active_storage-8.0.0 app/views/fields/active_storage/_form.html.erb
viniBaxter-field-active_storage-7.0.0 app/views/fields/active_storage/_form.html.erb
viniBaxter-field-active_storage-6.0.0 app/views/fields/active_storage/_form.html.erb
viniBaxter-field-active_storage-5.0.0 app/views/fields/active_storage/_form.html.erb