{# vim: set ts=2 et sts=2 sw=2: #}
{% extends "forums/base.html" %}
{% set title = _('Forums') %}
{% set crumbs = [(None, title)] %}

{% block content %}
<article id="forums" class="main">
  <h1>{{ title }}</h1>

  <ol class="forums-columns">
    <li class="name">{{ _('Name') }}</li>
    <li class="threads">{{ _('Threads') }}</li>
    <li class="last-post">{{ _('Last Post') }}</li>
  </ol>
  {% if forums.object_list %}
    <ol class="forums">
      {% for forum in forums.object_list %}
        <li>
          <div class="name">
            <a href="{{ url('forums.threads', forum_slug=forum.slug) }}">{{ forum.name }}</a><br/>
            {{ forum.description|safe }}
          </div>
          <div class="threads">{{ forum.thread_set.count() }}</div>
          <div class="last-post">
          {% if forum.last_post %}
            <a href="{{ forum.last_post.get_absolute_url() }}">
                {{ datetimeformat(forum.last_post.created) }}
            </a><br/>
            {{ _('by <a class="username" href="{profile_url}">{username}</a>')|fe(profile_url=profile_url(forum.last_post.author), username=forum.last_post.author.username) }}
          {% else %}
            {# Not localized because it's not worth localizers time. #}
            No posts.
          {% endif %}
          </div>
          <hr/>
        </li>
      {% endfor %}
    </ol>

    {{ forums|paginator }}
  {% else %}{# if forums #}
    {# Not localized because it's not worth localizers time. #}
    <p>There are no forums. You should create some!</p>
  {% endif %}
</article>
{% endblock %}
