<% if show_label %>
<%= render 'headmin/forms/label', form: form, attribute: attribute, name: label, required: required %>
<% end %>
<% if header %>
-
<%= render header %>
<% end %>
<%= form.fields_for attribute, associations do |ff| %>
<%= render 'headmin/forms/repeater/row', pass_thru: pass_thru, form: ff, repeater_id: repeater_id do %>
<%= yield(ff) %>
<% end %>
<% end %>
-
<%= t('.empty') %>
"
data-popup-pass-thru="<%= pass_thru %>"
data-action="click->repeater#resetButtonIndices click->popup#open"
>
<%= bootstrap_icon('plus') %>
<%= t('.add', name: association_model.model_name.human) %>
<%= render 'headmin/popup', id: "repeater-buttons-#{repeater_id}" do %>
<% end %>
<% template_names.each do |name| %>
<%= form.fields_for attribute, association_model.new, child_index: 'template_id' do |ff| %>
<%= render 'headmin/forms/repeater/row', form: ff, pass_thru: pass_thru, repeater_id: repeater_id do %>
<% template = templates.detect { |t| t.include?("/#{name}.") } %>
<% if template %>
<%= render(template.gsub('/_', '/'), form: ff) %>
<% else %>
<% yield(ff) %>
<% end %>
<% end %>
<% end %>
<% end %>