Sha256: 6244b86efea8b88770b4186f26cc0a857f2448892416ed24934eeebd1d08a3f6

Contents?: true

Size: 956 Bytes

Versions: 2

Compression:

Stored size: 956 Bytes

Contents

<%#
# BelongsToSearch Form Partial

This partial renders an search input element for belongs_to relationships.
By default, the input is a collection select box
that displays all possible records to associate with.

## Local variables:

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

<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-url': polymorphic_url([namespace, field.associated_class], format: :json),
               'data-limit': field.limit) 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-field-has_many_search-0.2.1 app/views/fields/has_many_search/_form.html.erb
administrate-field-has_many_search-0.2.0 app/views/fields/has_many_search/_form.html.erb