<div class="textile-form-body" data-behavior="textile-form-body">
  <% if @form_data.any? %>
    <% @form_data.each_with_index do |field, index| %>
      <%= render partial: 'field', locals: { field: field, index: index } %>
    <% end %>
  <% else %>
    <%= render partial: 'field', locals: { index: 0 } %>
  <% end %>
</div>

<div class="add-field">
  <%= link_to field_fields_path(index: @form_data.length + 1), data: { behavior: 'add-field' }, remote: true do %>
    <i class="fa-solid fa-plus"></i> Add field
  <% end %>
</div>
