noesya/osuny

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

Summary

Maintainability
Test Coverage
<%= simple_form_for [:admin, document] 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  :name %>
          <%= lf.input  :file,
                        as: :single_deletable_file,
                        direct_upload: true %>
        <% end %>
      </div>
      <div class="col-md-4">
        <%= osuny_panel t('metadata') do %>
          <% if can? :publish, document %>
            <%= lf.input :published %>
            <%= lf.input :published_at, html5: true, as: :date %>
          <% end %>
          <%= f.association :kind, collection: osuny_collection(@extranet.document_kinds, localized: true), include_blank: false %>
          <%= f.association :category, collection: osuny_collection(@extranet.document_categories, localized: true), include_blank: false %>
        <% end %>
      </div>
    </div>
    <% content_for :action_bar_right do %>
      <%= submit f %>
    <% end %>
  <% end %>
<% end %>