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

{% block sub-title %}{% trans "Moderation queue" %}{% endblock sub-title %}

{% block content %}
    <div class="row">
        <div class="col-xs-12">
            <h1>{% trans "Moderation queue" %}</h1>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-6 col-md-4 forum-actions-block">
            {% if paginator.count > 0 %}
                <p class="text-muted">
                    {% blocktrans with paginator.count as topic_length %}{{ topic_length }} posts found{% endblocktrans %}
                </p>
            {% endif %}
        </div>
        <div class="col-xs-12 col-md-8 pagination-block">
            {% with "pagination-sm" as pagination_size %}
                {% include "partials/pagination.html" %}
            {% endwith %}
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <div class="panel panel-default postmoderationlist">
                <div class="panel-heading">
                    <div class="row panel-row">
                        <div class="col-md-8 post-name-col">
                            <h3 class="panel-title">{% trans "Moderation queue" %}</h3>
                        </div>
                        <div class="col-md-2 moderation-col">{% trans "Topic" %}</div>
                        <div class="col-md-2 moderation-col">{% trans "Forum" %}</div>
                    </div>
                </div>
                <div class="panel-body">
                    {% for post in posts %}
                        <div class="row panel-row">
                            <div class="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.username 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 topic-name">
                                {% if post.is_topic_head %}
                                    <span class="label label-default">{% 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 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="row panel-row">
                            <div class="col-md-12">
                                {% trans "Not posts awaiting approval." %}
                            </div>
                        </div>
                    {% endfor %}
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12 col-md-12 pagination-block">
            {% with "pagination-sm" as pagination_size %}
                {% include "partials/pagination.html" %}
            {% endwith %}
        </div>
    </div>
{% endblock content %}
