26 lines
1.0 KiB
ERB
26 lines
1.0 KiB
ERB
<%#
|
|
# BelongsTo Form Partial
|
|
|
|
This partial renders an 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 [Administrate::Field::BelongsTo][1].
|
|
Contains helper methods for displaying a collection select box.
|
|
|
|
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/BelongsTo
|
|
%>
|
|
|
|
<div class="flex flex-col gap-1">
|
|
<%= f.label field.permitted_attribute, class: "text-sm font-medium text-n-slate-11" %>
|
|
<%= f.select(field.permitted_attribute,
|
|
options_for_select(field.associated_resource_options, field.selected_option),
|
|
{ include_blank: field.include_blank_option },
|
|
{ class: "h-9 px-3 min-w-[200px] text-sm text-n-slate-12 bg-n-solid-2 border border-n-weak rounded-lg focus:ring-2 focus:ring-woot-500 focus:border-woot-500 outline-none" }) %>
|
|
</div>
|