<%= render "admin/shared/globalize_locales", resource: @page %>

<%= translatable_form_for [:admin, @page], html: {class: "edit_page", data: {watch_changes: true}} do |f| %>
  <% if @page.errors.any? %>
    <div id="error_explanation" data-alert class="callout alert" data-closable>
      <button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
        <span aria-hidden="true">&times;</span>
      </button>

      <strong>
        <%= @page.errors.count %>
        <%= t("admin.site_customization.pages.errors.form.error", count: @page.errors.count) %>
      </strong>
    </div>
  <% end %>

  <div class="small-12 column">
    <hr>
  </div>

  <div class="small-12 medium-5 column">
    <h3><%= t("admin.site_customization.pages.form.options") %></h3>
    <%= f.check_box :more_info_flag, class: "small" %>
    <%= f.check_box :print_content_flag %>
  </div>
  <div class="small-12 medium-3 column">
    <%= f.label :status %>
    <% ::SiteCustomization::Page::VALID_STATUSES.each do |status| %>
      <%= f.radio_button :status, status, label: false %>
      <%= f.label "status_#{status}", t("admin.site_customization.pages.page.status_#{status}") %>
      <br>
    <% end %>
  </div>

  <div class="small-12 medium-4 column">
    <%= f.label :slug %>
    <%= f.text_field :slug, label: false, size: 80, maxlength: 80 %>
  </div>
  <div class="small-12 column">
    <hr>
    <%= f.translatable_fields do |translations_form| %>
      <%= translations_form.text_field :title %>
      <%= translations_form.text_field :subtitle %>
      <div class="ckeditor">
        <%= translations_form.cktext_area :content,
                                          ckeditor: { language: I18n.locale, toolbar: "admin" } %>
      </div>
    <% end %>

    <div class="small-12 medium-6 large-3 margin-top">
      <%= f.submit class: "button success expanded" %>
    </div>
  </div>
<% end %>
