{% import "macros.html" as macros %}
<form class="js-ask-form" action="{{ url('ask') }}" method="post"
  data-validated-fields="title,text"
  data-title-validator="askbot.validators.titleValidator"
  data-text-validator="askbot.validators.questionDetailsValidator"
  >{{ csrf_input }}
  <div class="form-item form-group ask-form-bar">
    <label for="id_title">{{ form.title.label }}</label>
    <div id="askFormBar" class="search-bar">
      <input id="id_title" class="questionTitleInput" name="title" autocomplete="off"
        value="{% if form.initial.title %}{{form.initial.title|escape}}{% endif %}"/>
      <div class="js-title-error js-error">
        {% if form.title.errors %}
          {{ form.title.errors }}
        {% endif %}
      </div>
    </div>
  </div>

  {% set text_field_id = form.text.field.widget.attrs.id %}
  {% if editor_is_folded %}
    <a class="js-question-body-trigger">{{ form.text.label }}</a>
    <div class="js-folded-editor">
      <label for="{{ text_field_id }}"
        class="js-text-label">{{ form.text.label }}</label>
      <div class="js-text-error js-error">
        {% if form.text.errors %}
          {{ form.text.errors }}
        {% endif %}
      </div>
      <div class="editor-proper">
        <div class="editor-placeholder"></div>
      </div>
    </div>
  {% else %}
    <label for="{{ text_field_id }}"
      class="js-text-label">{{ form.text.label }}</label>
    <div class="js-text-error js-error">
      {% if form.text.errors %}
        {{ form.text.errors }}
      {% endif %}
    </div>
    {{ macros.edit_post(form, settings) }}
{% endif %}

  {% include "ask/tags_field.html" %}

  {{ form.group_id }}

  <div class="question-options">
    {% set post_form=form %}
    {% include "components/proxy_author_inputs.html" %}
    {% if settings.WIKI_ON %}
      {{ macros.checkbox_in_div(form.wiki) }}
    {% endif %}
    {% if settings.ALLOW_ASK_ANONYMOUSLY %}
      {{ macros.checkbox_in_div(form.ask_anonymously) }}
    {% endif %}
    {% if settings.GROUPS_ENABLED and
      request.user.is_authenticated and
      request.user.can_make_group_private_posts()
    %}
      {{ macros.checkbox_in_div(form.post_privately) }}
    {% endif %}
    {% if settings.MULTILINGUAL %}
      {% if settings.LANGUAGES|length > 1 %}
      <div class="lang-selector">
        <label for="id_language">{% trans %}Select language{% endtrans %}</label>
        {{ form.language }}
      </div>
      {% else %}
        <input type="hidden" name="language" value="{{ settings.LANGUAGE_CODE }}" />
      {% endif %}
    {% endif %}
  </div>
  {% if form.recaptcha %}
    <div>{{ macros.form_field_with_errors(form.recaptcha) }}</div>
  {% endif %}
  {% if request.user.is_anonymous and not settings.ALLOW_ASK_UNREGISTERED %}
    <input class="btn" type="submit" name="post_anon" value="{% trans %}Login/Signup to Post{% endtrans %}" />
  {% else %}
    <input class="btn" type="submit" name="post" value="{{ settings.WORDS_ASK_YOUR_QUESTION|escape }}" />
  {% endif %}
</form>
