noesya/osuny

View on GitHub
app/views/admin/university/people/experiences/edit.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, @l10n %>

<h2 class="h3"><%= University::Person::Experience.model_name.human(count: 2) %></h2>

<%= simple_form_for [:admin, @person], url: experiences_admin_university_person_path(@person) do |f| %>
  <%= f.error_notification %>
  <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>

  <div class="mb-3">
    <%= link_to_add_association t('add'),
                                f,
                                :experiences,
                                class: button_classes,
                                data: {
                                  'association-insertion-method': 'append',
                                  'association-insertion-node':   '#experiences',
                                } %>
  </div>

  <div id="experiences">
    <%= f.simple_fields_for :experiences, @person.experiences.ordered, include_id: false do |experience_f| %>
      <%= render 'admin/university/people/experiences/experience_fields', f: experience_f, include_id: true %>
    <% end %>
  </div>

  <% content_for :action_bar_right do %>
    <%= submit f %>
  <% end %>
<% end %>