noesya/osuny

View on GitHub
app/views/admin/communication/websites/posts/_form.html.erb

Summary

Maintainability
Test Coverage
<%= simple_form_for [:admin, post] 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, input_html: { data: { translatable: true } } %>
          <%= lf.input :subtitle, input_html: { data: { translatable: true } } %>
          <%= render 'admin/application/summary/form', f: lf, about: l10n %>
          <%= lf.input :text, as: :summernote if strip_tags(l10n.text).present? %>
        <% end %>
        <%= render 'admin/application/categories/form', f: f, categories: @categories %>
        <%= render 'admin/application/meta_description/form', f: lf, about: l10n %>
      </div>
      <div class="col-md-4">
        <%= osuny_panel t('metadata') do %>
          <% if can? :publish, post %>
            <div class="row pure__row--small">
              <div class="col-6">
                <%= lf.input :published %>
              </div>
              <div class="col-6">
                <%= lf.input :pinned %>
              </div>
            </div>
            <%= lf.input :published_at, html5: true, as: :date %>
          <% end %>
          <%= f.association :author,
                            collection: osuny_collection(
                              current_university.people.authors,
                              localized: true,
                              label_method: :to_s_alphabetical
                            ) %>
          <%= render  "admin/application/slug/form",
                      f: lf,
                      source: '#communication_website_post_localizations_attributes_0_title' %>
        <% end %>
        <%= render 'admin/application/featured_image/edit', f: lf, about: @l10n %>
        <%= render 'admin/application/shared_image/edit', f: lf, about: @l10n %>
      </div>
    </div>

    <% content_for :action_bar_left do %>
      <%= render 'admin/application/l10n/libre_translate_button', l10n: @l10n %>
    <% end %>

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