app/views/application/_section_fields.html.erb

Summary

Maintainability
Test Coverage
<div class="fields" data-new-record=<%= section.new_record? %>>
  <%= form.simple_fields_for "section_attributes[]", section do |fields| %>
    <div class="sorting-controls">
      <a href="javascript:void(0)" data-behaviour="move-up">⬆️</a>
      <a href="javascript:void(0)" data-behaviour="move-down">⬇️</a>
    </div>

    <%= fields.input :title %>
    <%= fields.input :body, as: :rich_text_area %>
    <%= fields.input :position,
                     as: :hidden,
                     input_html: { data: { attribute: "position" } } %>
    <%= fields.input :_destroy,
                     as: :hidden,
                     input_html: { data: { attribute: "_destroy" } } %>
    <%= button_tag "Esborrar secció",
                   type: :button,
                   class: "push-right btn btn-danger btn-smaller",
                   data: { behaviour: "remove-record" } %>
  <% end %>
</div>