Sha256: c1be7e965ecd4b7d4ed58ff234f3733cf7a050ca43564803ea45258588d0ab5c

Contents?: true

Size: 1022 Bytes

Versions: 2

Compression:

Stored size: 1022 Bytes

Contents

<%#
# HasMany Form Partial

This partial renders an input element for has_many relationships.
By default, the input is a collection select box
that displays all possible records to associate with.
The collection select box supports multiple inputs,
and is augmented with [Selectize].

## Local variables:

- `f`:
  A Rails form generator, used to help create the appropriate input fields.
- `field`:
  An instance of [Administrate::Field::HasMany][1].
  Contains helper methods for displaying a collection select box.

[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
[Selectize]: http://brianreavis.github.io/selectize.js
%>

<div class="field-unit__label">
  <%= f.label field.attribute, for: "#{f.object_name}_#{field.attribute_key}" %>
</div>
<div class="field-unit__field">
  <%= f.select(field.attribute_key, nil, {}, multiple: true, data: {controller: field.html_controller}) do %>
    <%= options_for_select(field.associated_resource_options, field.selected_options) %>
  <% end %>
</div>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
administrate-1.0.0.beta3 app/views/fields/has_many/_form.html.erb
administrate-1.0.0.beta2 app/views/fields/has_many/_form.html.erb