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


{% block meta-extra %}
<link rel="canonical" href="{{ REQUEST_PATH }}" />
{% if paginator.previous > 1 %}
<link rel="prev" href="{{ REQUEST_PATH }}?page={{ paginator.previous }}" />
{% elif paginator.first %}
<link rel="prev" href="{{ REQUEST_PATH }}" />
{% endif %}
{% if paginator.next %}
<link rel="next" href="{{ REQUEST_PATH }}?page={{ paginator.next }}" />
{% endif %}
{% endblock meta-extra %}


{% block content %}
<div class="page page-threads page-threads-{{ list_type|default:'all' }} {% spaceless %}
  {% block extra-css %}{% endblock extra-css %}
{% endspaceless %}">

  <div class="page-header-bg">
    {% block page-header %}
    {% endblock page-header %}
  </div>

  <div class="container">

    {% block list-container %}
      {% if subcategories %}
        <noscript>
          <section class="toolbar" itemscope itemtype="http://schema.org/SiteNavigationElement">
            <ul class="list-inline subcategories-list">
              {% for subcategory in subcategories %}
                <li>
                  <a href="{{ subcategory.get_absolute_url }}{% if list_type != 'all' %}{{ list_type }}/{% endif %}" class="subcategory {% if subcategory.css_class %}subcategory-{{ subcategory.css_class }}{% endif %}">
                    {{ subcategory.name }}
                  </a>
                </li>
              {% endfor %}
            </ul>
          </section>
        </noscript>
      {% endif %}

      <section>
        <div class="threads-list ui-ready">
          {% block threads-list %}
            <ul class="list-group" itemscope itemtype="http://schema.org/ItemList">
              <meta itemprop="numberOfItems" content="{{ paginator.count }}">
              <meta itemprop="itemListOrder" content="http://schema.org/ItemListOrderDescending">
              {% for thread in threads %}
                {% block thread %}
                  {% include "misago/threadslist/thread.html" %}
                {% endblock thread %}
              {% empty %}
                <li class="list-group-item empty-message">
                  {% block list-empty-message %}
                    {% if list_type == 'all' %}
                      <p class="lead">
                        {% if category.level %}
                          {% trans "There are no threads in this category." %}
                        {% else %}
                          {% trans "There are no threads on this forum... yet!" %}
                        {% endif %}
                      </p>
                      <p>
                        {% trans "Why not start one yourself?" %}
                      </p>
                    {% else %}
                      <p class="lead">
                        {% trans "No threads matching specified criteria were found." %}
                      </p>
                    {% endif %}
                  {% endblock list-empty-message %}
                </li>
              {% endfor %}
            </ul>
          {% endblock threads-list %}
        </div>

        <noscript>
          {% if paginator.pages > 1 %}
            <nav role="navigation" itemscope itemtype="http://schema.org/SiteNavigationElement">
              <ul class="pager">
                {% if paginator.previous > 1 %}
                  <li class="previous">
                    <a href="{{ REQUEST_PATH }}?page={{ paginator.previous }}" rel="prev" title="{% trans 'Previous page' %}">
                      <span aria-hidden="true" class="material-icon">
                        arrow_back
                      </span>
                    </a>
                  </li>
                {% elif paginator.first %}
                  <li class="previous">
                    <a href="{{ REQUEST_PATH }}" rel="prev" title="{% trans 'Previous page' %}">
                      <span aria-hidden="true" class="material-icon">
                        arrow_back
                      </span>
                    </a>
                  </li>
                {% endif %}
                {% if paginator.next %}
                  <li class="next">
                    <a href="{{ REQUEST_PATH }}?page={{ paginator.next }}" rel="next" title="{% trans 'Next page' %}">
                      <span aria-hidden="true" class="material-icon">
                        arrow_forward
                      </span>
                    </a>
                  </li>
                {% endif %}
              </ul>
            </nav>
          {% endif %}
        </noscript>
      </section>
    {% endblock list-container %}
  </div>
</div>
{% endblock content %}