Sha256: e73cf556db3649024573b29c1abee554a6bba35a45311590c776b3ded5918400

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

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.permitted_attribute %>
</div>
<div class="field-unit__field">
  <% if field.associated_class == Package %>
    <%= render(
        partial: "fields/belongs_to_search/scope_package",
        locals: {
          f: f,
          field: field,
        },
      ) %>
  <%else %>
    <%= f.select(field.permitted_attribute,
        nil,
        {},
        'data-url': polymorphic_url([namespace, field.associated_class], format: :json)) do %>
      <%= options_for_select(field.associated_resource_options, field.selected_option) %>
    <% end %>
  <% end %>
</div>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
viniBaxter-spa-belongs_to_search-3.0.0 app/views/fields/belongs_to_search/_form.html.erb
viniBaxter-spa-belongs_to_search-2.1.0 app/views/fields/belongs_to_search/_form.html.erb
viniBaxter-spa-belongs_to_search-2.0.0 app/views/fields/belongs_to_search/_form.html.erb