{% extends "site_base.html" %}
{% load thumbnail %}

{% block "metas" %}
    <title>{{ title }} - {{ settings.SITE_TITLE }}</title>
    <meta name="description" content="{{ description }}" />
{% endblock "metas" %}

{% block "breadcrumbs" %}
  <ul class="breadcrumb">
    <li><i class="icon-home"></i> <a href="{% url app_forum-forum-index %}">{{ _('Forum') }}</a> <span class="divider">/</span></li>
    <li><i class="icon-folder-open"></i> {{ myforum.title }}</li>
  </ul>
{% endblock "breadcrumbs" %}

{% block "content" %}
<section id="forum">

  {% include "rforum/elements/forum-top.html" %}
  {% include "rforum/elements/actions-forum.html" %}

  <div class="forum">
    <table class="table table-bordered">
      <thead>
        <tr>
          <th colspan="2">{{ _('Topics') }}</th>
          <th style="text-align: center;">{{ _('Replies') }}</th>
          <th style="text-align: center;">{{ _('Views') }}</th>
          <th>{{ _('Last Post') }}</th>
        </tr>
      </thead>
      <tbody>
        {% for topic in myforum.topics.all %}
        {% if topic.status = 1 %}
        <tr class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}">
          {% if topic.closed and topic.sticky %}<td style="text-align: center;"><img src="{{ STATIC_URL }}img/rforum/sticky_closed.gif" alt="{{ topic.title }}"{% endif %}
          {% if topic.closed and not topic.sticky %}<td style="text-align: center;"><img src="{{ STATIC_URL }}img/rforum/closed.gif" alt="{{ topic.title }}"{% endif %}
          {% if not topic.closed and topic.sticky %}<td style="text-align: center;"><img src="{{ STATIC_URL }}img/rforum/sticky.gif" alt="{{ topic.title }}"{% endif %}
          {% if not topic.closed and not topic.sticky %}<td style="text-align: center;"><img src="{{ STATIC_URL }}img/rforum/topic.gif" alt="{{ topic.title }}"{% endif %}
          title="{{ topic.title }}" style="margin-top: 8px" /></td>
          <td>
            <a href="{% url app_forum-topic-list myforum.slug topic.slug %}" class="forum-title">{{ topic.title }}</a>
            <p>{{ _('by') }}: <a href="{% url app_forum-userprofile topic.user %}">{{ topic.user }}</a> &rarr; {{ topic.date_created  }}</p>
          </td>
          <td style="text-align: center;">{{ topic.posts.count|add:"-1" }}</td>
          <td style="text-align: center;">{{ topic.hits }}</td>
          <td>
            {% for p in topic.posts.all %}
                {% if forloop.last %}
                    <p><a href="{% url app_forum-topic-list myforum.slug topic.slug %}#{{ p.id }}">#</a> {{ _('by') }}: <a href="{% url app_forum-userprofile p.user %}">{{ p.user }}</a></p><p>{{ p.date_modified }}</p>
                {% endif %}
            {% endfor %}
            </td>
        </tr>
        {% endif %}
        {% endfor %}
      </tbody>
    </table>
  </div>

  {% include "rforum/elements/actions-forum.html" %}
  {% include "rforum/elements/forum-bottom.html" %}

</section>
{% endblock "content" %}
