{% import "macros.html" as macros %}
<div id="js-post-controls-{{answer.id}}" class="js-answer-controls js-post-controls" data-post-id="{{answer.id}}">
  <span id="js-edit-btn-post-body-{{answer.id}}" class="action-link with-edit-icon js-edit">
    {% trans %}edit{% endtrans %}
  </span>
  {{ macros.post_flag_buttons(answer) }}
  <span
    id='js-post-delete-btn-{{answer.id}}'
    class="action-link js-post-delete-btn with-delete-icon"
    data-post-id="{{answer.id}}"
  >
    {% if answer.deleted %}{% trans %}undelete{% endtrans %}{% else %}{% trans %}delete{% endtrans %}{% endif %}
  </span>
  {% if settings.GROUPS_ENABLED %}
    {% set is_published=(answer.id in published_answer_ids) %}
    <span
      id="js-post-publish-btn-{{answer.id}}"
      class="action-link {% if is_published %}js-unpublish-post with-bullhorn-icon with-slashed-icon{% else %}js-publish-post with-bullhorn-icon{% endif %}"
      data-post-id={{answer.id}}
    >
      {% if is_published %}
        {% trans %}unpublish{% endtrans %}</a>
      {% else %}
        {% trans %}publish{% endtrans %}</a>
      {% endif %}
    </span>
    {% if request.user.is_anonymous or not request.user.can_publish_group_private_post(question) %}
      <script type="text/javascript">
        document.getElementById("js-post-publish-btn-" + '{{answer.pk}}').remove();
      </script>
    {% endif %}
  {% endif %}
  <a class="action-link with-link-icon"
    href="{{ answer.get_absolute_url(question_post=question) }}"
    title="{% trans %}permanent link{% endtrans %}"
  >{% trans %}link{% endtrans %}</a>
  <div class="js-dropdown-menu js-toolbar-dropdown-menu action-link">
    <div class="js-dropdown-trigger with-caret-down-icon">{% trans %}more{% endtrans %}</div>
    <ul class="js-dropdown-target">
      <li id='post-{{answer.id}}-convert'>
        <form class="answer-convert"
          action="{{ url('repost_answer_as_comment_under_question') }}"
          method="post"
        >
          {{ csrf_input }}
          <input type="hidden" name="answer_id" value="{{answer.id}}"/>
          <input
            type="submit"
            class="action-link"
            value="{{ settings.WORDS_REPOST_AS_A_QUESTION_COMMENT|escape }}"
          />
        </form>
      </li>
      <li id='post-{{ answer.id }}-repost-as-comment-under-previous-answer'>
        <form class="answer-convert repost-as-comment-under-previous-answer"
          action="{{ url('repost_answer_as_comment_under_previous_answer') }}"
          method="post"
        >
          {{ csrf_input }}
          <input type="hidden" name="answer_id" value="{{ answer.id }}"/>
          <input type="submit"
            class="action-link"
            value="{{ settings.WORDS_REPOST_AS_A_COMMENT_UNDER_THE_OLDER_ANSWER|escape }}"
          />
        </form>
      </li>
    </ul>
  </div>
  <script type="text/javascript">
      askbot['functions']['hideConvertAnswerLinks']('{{ answer.id }}');
      askbot['functions']['hidePublishPostLinks']();
      askbot['functions']['renderPostControls']('{{ answer.id }}'{{ ', true' if answer.wiki }});
  </script>
</div>
