{% import "macros.html" as macros %}

{% include "question/question_card.html" %}

{% if answers %}
    <div class="clean"></div>

    {% include "question/answer_tab_bar.html" %}

    <div class="clean"></div>
    {{ macros.paginator(paginator_context, anchor='#sort-top') }}
    <div class="clean"></div>

    {% for answer in answers %}
        {% include "question/answer_card.html" %}
        {% if loop.index == 1 and 'QUESTION_PAGE_ANSWER_BANNER'|show_block_to(request.user) %}
            <div class="banner">{{ settings.QUESTION_PAGE_ANSWER_BANNER|safe }}</div>
        {% endif %}
    {% endfor %}

    {{ macros.paginator(paginator_context, anchor='#sort-top') }}
    <div class="clean"></div>
{% elif settings.QUESTION_PAGE_ALWAYS_SHOW_ANSWER_BANNER %}
    <div class="clearfix"></div>
    {% if 'QUESTION_PAGE_ANSWER_BANNER'|show_block_to(request.user) %}
        <div class="banner">{{ settings.QUESTION_PAGE_ANSWER_BANNER|safe }}</div>
    {% endif %}
{% endif %}

{# buttons below cannot be cached yet #}
{% if new_answer_allowed %}
    {% include "question/new_answer_form.html" %}
{% else %}
    <div style="margin-top: 15px">
        <a
            class="button submit"
            href="{% url "edit_answer" previous_answer.id %}"
        >{{ settings.WORDS_EDIT_YOUR_PREVIOUS_ANSWER|escape }}</a>
        <span>{{ settings.WORDS_ONLY_ONE_ANSWER_PER_USER_IS_ALLOWED|escape }}</span>
        <div class="invisible">
            {# hidden because we still need js from the tinymce widget #}
            {% include "question/new_answer_form.html" %}
        </div>
    </div>
{% endif %}
{% if question.closed == False and request.user == question.author %}{# this is outside the form on purpose #}
<input 
  type="button"
  class="submit after-editor answer-own-question"
  id="fmanswer_button"
  value="{{ settings.WORDS_ANSWER_YOUR_OWN_QUESTION|escape }}"
/>
{% endif %}
