noesya/osuny

View on GitHub
app/views/admin/research/theses/_form.html.erb

Summary

Maintainability
Test Coverage
<%= simple_form_for [:admin, thesis] do |f| %>
  <%= f.simple_fields_for :localizations, l10n do |lf| %>
    <%= f.error_notification %>
    <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
    <%= lf.hidden_field :language_id, value: current_language.id %>

    <div class="row">
      <div class="col-xl-6">
        <%= lf.input :title %>
        <%= lf.input :abstract, input_html: { rows: 10 } %>
      </div>
      <div class="col-xl-6">
        <%= f.input :started_at, html5: true %>
        <%= f.input :completed %>
        <%= f.input :completed_at, html5: true %>
        <%= f.association :laboratory,
                          collection: osuny_collection(
                            current_university.research_laboratories
                                              .ordered(current_language), 
                            localized: true
                          ) %>
        <%= f.association :author,
                          collection: osuny_collection(
                            current_university.people
                                              .researchers
                                              .ordered(current_language), 
                            localized: true
                          ) %>
        <%= f.association :director,
                          collection: osuny_collection(
                            current_university.people
                                              .with_habilitation
                                              .ordered(current_language), 
                            localized: true
                          ) %>
      </div>
    </div>
    <% content_for :action_bar_right do %>
      <%= submit f %>
    <% end %>
  <% end %>
<% end %>