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

<%= translatable_form_for [:admin, @process, @question], url: url, html: {data: {watch_changes: true}} do |f| %>

  <% if @question.errors.any? %>
    <div class="small-12 medium-9 column">
      <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>
          <%= @question.errors.count %>
          <%= t("admin.legislation.questions.errors.form.error", count: @question.errors.count) %>
        </strong>
      </div>
    </div>
  <% end %>

  <%= f.translatable_fields do |translations_form| %>
    <div class="small-12 medium-9 column end">
      <%= translations_form.text_area :title,
                                      rows: 5,
                                      placeholder: t("admin.legislation.questions.form.title_placeholder"),
                                      label: t("admin.legislation.questions.form.title") %>
    </div>
  <% end %>

  <div class="small-12 medium-9 column">
    <%= f.label :question_options, t("admin.legislation.questions.form.question_options") %>
  </div>

  <div id="nested_question_options">
    <%= f.fields_for :question_options do |ff| %>
      <%= render 'question_option_fields', f: ff %>
    <% end %>

    <div class="js-add-fields-container">
      <div class="small-12 medium-9 column">
        <%= link_to_add_association t("admin.legislation.questions.form.add_option"),
                                  f, :question_options, class: "button hollow"  %>
      </div>
    </div>
  </div>

  <div class="small-12 medium-6 large-3 clear column end margin-top">
    <%= f.submit(class: "button success expanded", value: t("admin.legislation.questions.#{admin_submit_action(@question)}.submit_button")) %>
  </div>
<% end %>
