Sha256: 00775990190f65b8f37ca3d50e58cd149482e888faad59613c0b84cad1cca2c4

Contents?: true

Size: 1.9 KB

Versions: 2

Compression:

Stored size: 1.9 KB

Contents

<% if request.env["PATH_INFO"] == "/admin/quotations/new"  ||  "/admin/quotations/edit"%>

  <fieldset class="field-unit--nested fieldset_<%= field.attribute %>">
    <div class="container-flex">
      <!-- <legend><%= f.label field.attribute %></legend> -->
      <%= f.fields_for field.association_name do |nested_form| %>
          <%= render(
            partial: "fields/nested_has_many/fields",
            locals: {
              f: nested_form,
              field: field,
            },
          ) %>
      <% end %>
      <div class = "add_has_many">
        <%= link_to_add_association(
          I18n.t("administrate.fields.nested_has_many.add", resource: field.associated_class_name.titleize),
          f,
          field.association_name,
          class: "button toto button_add_associated_#{field.associated_class_name}",
          # class: "button toto button_add_associated_#{field.associated_class_name}",
          # # id usefull for the JS inside New quotation
          # id: "button_add_associated_#{field.associated_class_name}",
          partial: "fields/nested_has_many/fields",
          render_options: { locals: { field: field } },
        ) %>
      </div>
    </div>
  </fieldset>

<% else %>
  <fieldset class="field-unit--nested">
    <legend><%= f.label field.attribute %></legend>
    <%= f.fields_for field.association_name do |nested_form| %>
        <%= render(
          partial: "fields/nested_has_many/fields",
          locals: {
            f: nested_form,
            field: field,
          },
        ) %>
    <% end %>

    <div>
      <%= link_to_add_association(
        I18n.t("administrate.fields.nested_has_many.add", resource: field.associated_class_name.titleize),
        f,
        field.association_name,
        class: 'button',
        partial: "fields/nested_has_many/fields",
        render_options: { locals: { field: field } },
      ) %>
    </div>
  </fieldset>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
worker-field-nested_has_many-0.4.0 app/views/fields/nested_has_many/_form.html.erb
worker-field-nested_has_many-0.3.0 app/views/fields/nested_has_many/_form.html.erb