noesya/osuny

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

Summary

Maintainability
Test Coverage
<%= simple_form_for [:admin, paper] 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-md-8">
        <%= osuny_panel t('content') do %>
          <%= lf.input :title, as: :text, input_html: { rows: 3 } %>
          <%= render 'admin/application/summary/form', f: lf, about: l10n %>
          <%= lf.input :abstract, as: :text, input_html: { rows: 8 } %>
          <%= lf.input :pdf, as: :single_deletable_file %>
          <%= f.input :doi %>
        <% end %>
      </div>
      <div class="col-md-4">
        <%= osuny_panel t('metadata') do %>
          <%= render  "admin/application/slug/form",
                      f: lf,
                      source: '#research_journal_paper_localizations_attributes_0_title' %>
          <%= f.association :volume, 
                            collection: osuny_collection(@journal.volumes, localized: true) %>
          <%= lf.input :published %>
          <%= lf.input :published_at, html5: true, as: :date %>
          <%= f.input :accepted_at, html5: true, as: :date %>
          <%= f.input :received_at, html5: true, as: :date %>
          <%= lf.input :keywords, as: :text, input_html: { rows: 2 } %>
          <%= f.association :people,
                            collection: osuny_collection(
                              current_university.people
                                                .researchers
                                                .ordered(current_language), 
                              localized: true
                            ),
                            as: :check_boxes %>
          <%= lf.input :authors_list %>
          <%= f.association :kind, collection: osuny_collection(@journal.kinds, localized: true) if @journal.kinds.any? %>
        <% end %>
        <%= render 'admin/application/meta_description/form', f: lf, about: l10n %>
      </div>
    </div>
    <% content_for :action_bar_right do %>
      <%= submit f %>
    <% end %>
  <% end %>
<% end %>