{% extends "forum_base.html" %}
{% load i18n forum_tags %}

{% block title %}{{ block.super }} / {{ forum.title }}{% endblock %}

{% block extrahead %}
<link rel="alternate" type="application/rss+xml" title="{% blocktrans with forum.title as ftitle %}{{ ftitle }} Posts via RSS{% endblocktrans %}" href="{% url forum_index %}rss/{{ forum.slug }}/" />
<link rel="alternate" type="application/atom+xml" title="{% blocktrans with forum.title as ftitle %}{{ ftitle }} Posts via ATOM{% endblocktrans %}" href="{% url forum_index %}atom/{{ forum.slug }}/" />
{% endblock %}

{% block pagetitle %}{{ forum.title }}{% endblock %}

{% block breadcrumbs %} {% for title, url in forum.get_url_name %} &raquo; <a href='{{ url }}'>{{ title }}</a> {% endfor %} ({{ forum.threads }} {% trans "thread" %}{{ forum.threads|pluralize }}, {{ forum.posts }} {% trans "post" %}{{ forum.posts|pluralize }}){% endblock %}


{% block content %}

{% if child_forums %}
<table id='djangoForumList'>
<tr>
<th>{% trans "Sub-Forum" %}</th>
<th>{% trans "Last Post" %}</th>
</tr>

{% for subforum in child_forums %}
<tr>
<td class='djangoForumListDetails'><p><strong><a href='{{ subforum.get_absolute_url }}'>{{ subforum.title }}</a></strong><br /><span class='djangoForumStats'>{{ subforum.threads }} {% trans "thread" %}{{ subforum.threads|pluralize }}, {{ subforum.posts }} {% trans "post" %}{{ subforum.posts|pluralize }}</span></p>
<p>{{ subforum.description }}</p></td>
{% with subforum.forum_latest_post as latest_post %}
<td class='djangoForumListLastPost'>{% if latest_post %}{% blocktrans with post.time|timesince as time and latest_post.author as author %}{{ time }} ago by {{ author }}{% endblocktrans %} (<a href='{{ latest_post.get_absolute_url }}'>{% trans "view" %}</a>){% else %}{% trans "No Posts" %}{% endif %}</td>
{% endwith %}
</tr>
{% endfor %}
</table>
<br />
{% endif %}

<table id='djangoForumThreadList'>

<tr>
<th>{% trans "Thread" %}</th>
<th style='width: 50px;'>{% trans "Posts" %}</th>
<th style='width: 50px;'>{% trans "Views" %}</th>
<th style='width: 220px;'>{% trans "Last Post" %}</th>
</tr>

{% for t in thread_list %}
<tr>
<td>{% if t.sticky %}Sticky {% endif %}<a href='{{ t.get_absolute_url }}'>{{ t.title|escape }}</a>{% if t.closed %} (Closed){% endif %}</td>
<td style='width: 50px;'>{{ t.posts }}</td>
<td style='width: 50px;'>{{ t.views }}</td>
{% with t.thread_latest_post as latest_post %}
<td style='width: 220px;' class='djangoForumThreadLastPost'>{% blocktrans with latest_post.time|timesince as time and latest_post.author as author %}{{ time }} ago by {{ author }}{% endblocktrans %} (<a href='{{ latest_post.get_absolute_url }}'>{% trans "view" %}</a>)</td>
{% endwith %}
</tr>
{% endfor %}
</table>

{% if is_paginated %}
<ul>
  <li class="djangoForumPagination"><a href="?page=1">{% trans "First" %}</a></li>
{% for page_number in paginator.page_range %}
  <li class="djangoForumPagination"><a href="?page={{ page_number }}">{{ page_number }}</a></li>  
{% endfor %}
  <li class="djangoForumPagination"><a href="?page={{ paginator.num_pages }}">{% trans "Last" %}</a></li>  
</ul>
{% endif %}

<h2>{% trans "Create a Thread" %}</h2>
{% if user|can_post_in:forum %}
<form method='post' action='new/'>{% csrf_token %}
<p><label>{% trans "Posting As" %}</label><span>{{ user.username }}</span></p>
{{ form.as_p }}
<p><input type='submit' value='{% trans "Post" %}' /></p>
</form>
{% else %}
<p>Please login to create a thread.</p>
{% endif %}

{% endblock %}
