Sha256: 1dcbd757a42872a6113aebee486aa2ab9bb082063de2271ff6fa5a237b644555

Contents?: true

Size: 920 Bytes

Versions: 6

Compression:

Stored size: 920 Bytes

Contents

<%#
# 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><%= field.nested_form.resource_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 %>

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
administrate-0.10.0 app/views/fields/has_one/_form.html.erb
semantic-administrate-0.1.1 app/views/fields/has_one/_form.html.erb
administrate-0.9.0 app/views/fields/has_one/_form.html.erb
semantic-administrate-0.1.0 app/views/fields/has_one/_form.html.erb
administrate-0.8.1 app/views/fields/has_one/_form.html.erb
administrate-0.8.0 app/views/fields/has_one/_form.html.erb