<% page = f.object %> <%= render layout: 'spotlight/shared/dd3_item', locals: { id: page.id.to_s, field: f, label: page.title, label_method: :title, enabled_method: :published } do |_, section| %> <% case section when :additional_options %> <%- if page.feature_page? -%> <%= f.hidden_field :parent_page_id, data: {property: "parent_page"} %> <% end %> <% when :nested_components %> <% if page.feature_page? and page.child_pages.present? %>
    <% page.child_pages.each do |child_page| %> <%= parent_form.fields_for page_collection_name, child_page do |p| %> <%= render partial: 'page', locals: {f: p, parent_form: parent_form} %> <% end %> <% end %>
<% end %> <% end %> <% end %>