noesya/osuny

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

Summary

Maintainability
Test Coverage
<%= simple_form_for [:admin, post] do |f| %>
  <%= f.error_notification %>
  <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
  <%= f.simple_fields_for :localizations, l10n do |lf| %>
    <%= 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 %>
          <%= render 'admin/application/summary/form', f: lf, about: l10n %>
        <% end %>
      </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 :category,
                            collection: osuny_collection(@extranet.post_categories, localized: true) %>
          <%= f.association :author,
                            collection: osuny_collection(@extranet.connected_people, localized: true) %>
          <%= render  "admin/application/slug/form",
                      f: lf,
                      source: '#communication_extranet_post_localizations_attributes_0_title' %>
        <% end %>
        <%= render 'admin/application/featured_image/edit', f: lf, about: @l10n %>
      </div>
    </div>
    <% content_for :action_bar_right do %>
      <%= submit f %>
    <% end %>
  <% end %>
<% end %>