Repository URL to install this package:
|
Version:
0.19.0 ▾
|
<%#
# HasOne Form Partial
This partial renders an input element for has_one relationships.
The form will be rendered as nested_from to parent relationship.
## Local variables:
- `f`:
A Rails form generator, used to help create the appropriate input fields.
- `field`:
An instance of [Administrate::Field::HasOne][1].
A wrapper around the has_one relationship pulled from the database.
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasOne
%>
<%= f.fields_for field.attribute, field.data || field.nested_form.resource.class.new do |has_one_f| %>
<fieldset class="field-unit--nested">
<legend><%= t "helpers.label.#{f.object_name}.#{field.name}", default: field.name.titleize %></legend>
<% field.nested_form.attributes.each do |attribute| -%>
<div class="field-unit field-unit--<%= attribute.html_class %>">
<%= render_field attribute, f: has_one_f %>
</div>
<% end -%>
</fieldset>
<% end %>