{% extends 'board_base.html' %}
{% load i18n %}
{% load forum_member_tags %}

{% block sub_title %}{% trans "Moderation queue" %}{% endblock sub_title %}

{% block content %}
<div class="row">
  <div class="col-12">
    <h1>{% trans "Moderation queue" %}</h1>
  </div>
</div>
<div class="mb-3 row">
  <div class="col-6 col-md-4 forum-actions-block">
    {% if paginator.count > 0 %}
    <p class="mt-1 mb-0 text-muted">
      {% blocktrans with paginator.count as topic_length %}{{ topic_length }} posts found{% endblocktrans %}
    </p>
    {% endif %}
  </div>
  <div class="col-12 col-md-8 pagination-block">
    {% with "pagination-sm justify-content-end" as pagination_size %}
    {% include "partials/pagination.html" %}
    {% endwith %}
  </div>
</div>
<div class="row">
  <div class="col-12">
    <div class="card postmoderationlist">
      <div class="card-header">
        <div class="row panel-row">
          <div class="col-12 col-md-8 post-name-col">
            <h3 class="m-0 card-title h5">{% trans "Moderation queue" %}</h3>
          </div>
          <div class="col-md-2 d-none d-md-block moderation-col">{% trans "Topic" %}</div>
          <div class="col-md-2 d-none d-md-block moderation-col">{% trans "Forum" %}</div>
        </div>
      </div>
      <div class="p-0 card-body">
        {% for post in posts %}
        <div class="m-0 row">
          <div class="col-12 col-md-8 post-name">
            <table class="post-data-table">
              <tr>
                <td class="post-name">
                  <a href="{% url 'forum_moderation:queued_post' post.pk %}" class="post-name-link">{{ post.subject }}</a>
                  <div>
                    <div class="post-created">
                      {% if post.poster %}
                      {% url 'forum_member:profile' post.poster_id as poster_url %}
                      {% blocktrans trimmed with poster_url=poster_url username=post.poster|forum_member_display_name creation_date=post.created %}
                      By: <a href="{{ poster_url }}">{{ username }}</a> on {{ creation_date }}
                      {% endblocktrans %}
                      {% else %}
                      {% blocktrans trimmed with poster_username=post.username creation_date=post.created %}
                      By: {{ poster_username }} on {{ creation_date }}
                      {% endblocktrans %}
                      {% endif %}
                    </div>
                  </div>
                </td>
              </tr>
            </table>
          </div>
          <div class="col-md-2 d-none d-md-block topic-name">
            {% if post.is_topic_head %}
            <span class="badge badge-secondary">{% trans "New topic" %}</span>
            {% else %}
            <a href="{% url 'forum_conversation:topic' forum_slug=post.topic.forum.slug forum_pk=post.topic.forum.pk slug=post.topic.slug pk=post.topic.pk %}" class="post-name-link">{{ post.topic.subject }}</a>
            {% endif %}
          </div>
          <div class="col-md-2 d-none d-md-block forum-name">
            <a href="{% url 'forum:forum' slug=post.topic.forum.slug pk=post.topic.forum.pk %}" class="post-name-link">{{ post.topic.forum.name }}</a>
          </div>
        </div>
        {% empty %}
        <div class="py-2 px-3 m-0 row">
          <div class="p-0 col-12">
            {% trans "No posts awaiting approval." %}
          </div>
        </div>
        {% endfor %}
      </div>
    </div>
  </div>
</div>
<div class="row">
  <div class="col-12 pagination-block">
    {% with "pagination-sm justify-content-end" as pagination_size %}
    {% include "partials/pagination.html" %}
    {% endwith %}
  </div>
</div>
{% endblock content %}
