Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
annotator-administrate / app / views / fields / has_one / _form.html.erb
Size: Mime:
<%#
# 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 %>