{% extends "misago/userslists/base.html" %}
{% load i18n misago_avatars %}


{% block title %}{% trans "Active posters" %} | {{ block.super }}{% endblock %}


{% block meta-description %}
  {% if users_count %}
    {% blocktrans trimmed with posters=users_count days=tracked_period count counter=users_count %}
      {{ posters }} most active poster from last {{ days }} days.
    {% plural %}
      {{ posters }} most active posters from last {{ days }} days.
    {% endblocktrans %}
  {% else %}
    {% blocktrans trimmed with days=tracked_period %}
      No users have posted any new messages during last {{ days }} days.
    {% endblocktrans %}
  {% endif %}
{% endblock meta-description %}


{% block og-title %}{% trans "Active posters" %}{% endblock %}


{% block og-description %}
  {% if users_count %}
    {% blocktrans trimmed with posters=users_count days=tracked_period count counter=users_count %}
      {{ posters }} most active poster from last {{ days }} days.
    {% plural %}
      {{ posters }} most active posters from last {{ days }} days.
    {% endblocktrans %}
  {% else %}
    {% blocktrans trimmed with days=tracked_period %}
      No users have posted any new messages during last {{ days }} days.
    {% endblocktrans %}
  {% endif %}
{% endblock og-description %}


{% block og-url %}{{ SITE_ADDRESS }}{{ REQUEST_PATH }}{% endblock %}


{% block content %}
{{ block.super }}

<div class="active-posters-list">
  <div class="container">

    {% if users_count %}
      <p class="lead">
        {% blocktrans trimmed with posters=users_count days=tracked_period count counter=users_count %}
        {{ posters }} most active poster from last {{ days }} days.
        {% plural %}
        {{ posters }} most active posters from last {{ days }} days.
        {% endblocktrans %}
      </p>

      <div class="active-posters ui-ready">
        <ul class="list-group" itemscope itemtype="http://schema.org/ItemList">
          {% for ranked in users %}
            {% url 'misago:user' slug=ranked.slug pk=ranked.pk as user_url %}
            <li class="list-group-item{% if ranked.rank.css_class %} list-group-rank-{{ ranked.rank.css_class }}{% endif %}" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
              <div class="rank-user-avatar">
                <a href="{{ user_url }}">
                  <img src="{{ ranked|avatar:50 }}" alt="{% trans "Avatar" %}" class="avatar">
                </a>
              </div>

              <div class="rank-user">
                <div class="user-name">
                  <a href="{{ user_url }}" class="item-title" itemprop="url">
                    <span itemprop="name">{{ ranked }}</span>
                  </a>
                </div>
                <div class="user-details">
                  {% if ranked.rank.is_tab %}
                    <a href="{% url 'misago:users-rank' slug=ranked.rank.slug %}" class="rank-name item-title">
                      {{ ranked.rank.name }}
                    </a>
                  {% else %}
                    <span class="rank-name item-title">
                      {{ ranked.rank.name }}
                    </span>
                  {% endif %}
                  {% if ranked.title %}
                    <span class="user-title hidden-xs hidden-sm">
                      {{ ranked.title }}
                    </span>
                  {% endif %}
                </div>
                <div class="user-compact-stats visible-xs-block">
                  <span class="rank-position">
                    <strong>#{{ forloop.counter }}</strong>
                    <small>{% trans "Rank" %}</small>
                  </span>
                  <span class="rank-posts-counted">
                    <strong>{{ ranked.score }}</strong>
                    <small>{% trans "Ranked posts" %}</small>
                  </span>
                </div>
              </div>

              <div class="rank-position hidden-xs">
                <strong>#{{ forloop.counter }}</strong>
                <small>{% trans "Rank" %}</small>
              </div>

              <div class="rank-posts-counted hidden-xs">
                <strong>{{ ranked.score }}</strong>
                <small>{% trans "Ranked posts" %}</small>
              </div>

              <div class="rank-posts-total hidden-xs">
                <strong>{{ ranked.posts }}</strong>
                <small>{% trans "Total posts" %}</small>
              </div>

              <meta itemprop="position" content="{{ forloop.counter }}" />
            </li>
          {% endfor %}
          <meta itemprop="numberOfItems" content="{{ users|length }}">
          <meta itemprop="itemListOrder" content="http://schema.org/ItemListOrderDescending">
        </ul>
      </div>
    {% else %}
      <p class="lead">
        {% blocktrans trimmed with days=tracked_period %}
        No users have posted any new messages during last {{ days }} days.
        {% endblocktrans %}
      </p>
    {% endif %}

  </div>
</div>
{% endblock content %}