view gpp/templates/forums/forum_index.html @ 161:445e1466a98d

Implement #47; add goto page links on topics in the forum index view.
author Brian Neal <bgneal@gmail.com>
date Tue, 22 Dec 2009 03:31:43 +0000
parents f8f4514b806a
children cf9f9d4c4d54
line wrap: on
line source
{% extends 'base.html' %}
{% load forum_tags %}
{% block title %}Forums: {{ forum.name }}{% endblock %}
{% block content %}
<h2>Forums: {{ forum.name }}</h2>

<h3>
   <a href="{% url forums-index %}">SurfGuitar101 Forum Index</a> &raquo;
   <a href="{% url forums-forum_index slug=forum.slug %}">{{ forum.name }}</a>
</h3>

<div class="forum-block">
{% if user.is_authenticated %}
<a href="{% url forums-new_topic slug=forum.slug %}">New Topic</a> &bull;
<form action="{% url forums-catchup slug=forum.slug %}" method="post" style="display:inline">
   <input type="submit" value="Mark All Topics Read" />
</form>
{% endif %}
{{ page_nav }}
<table class="forum-index-table">
   <thead>
      <tr>
         <th class="forum-index_title">Topics</th>
         <th class="forum-index_replies">Replies</th>
         <th class="forum-index_author">Author</th>
         <th class="forum-index_views">Views</th>
         <th class="forum-index_last_post">Last Post</th>
      </tr>
   </thead>
   <tbody>
   {% for topic in page.object_list %}
      <tr class="{% cycle 'odd' 'even' %}">
         <td>
            {% if topic.has_unread %}<img src="{{ MEDIA_URL }}icons/new.png" alt="New Posts" title="New Posts" class="forums-topic-icon" />{% endif %}
            {% if topic.sticky %}<img src="{{ MEDIA_URL }}icons/asterisk_orange.png" alt="Sticky" title="Sticky" class="forums-topic-icon" />{% endif %}
            {% if topic.locked %}<img src="{{ MEDIA_URL }}icons/lock.png" alt="Locked" title="Locked"
            class="forums-topic-icon" />{% endif %}
            <h4><a href="{{ topic.get_absolute_url }}">{{ topic.name }}</a></h4>
            {% if topic.page_range %}
            <span class="small">Goto page: [
            {% for n in topic.page_range %}
               {% if n %}
               <a href="{{ topic.get_absolute_url }}?page={{ n }}">{{ n }}</a>
               {% else %}
               &hellip;
               {% endif %}
            {% endfor %}
            ]</span>
            {% endif %}
         </td>
         <td class="forum-index_replies">{{ topic.reply_count }}</td>
         <td class="forum-index_author"><a href="{% url bio-view_profile username=topic.user.username %}" title="View profile for {{ topic.user.username }}">{{ topic.user.username }}</a></td>
         <td class="forum-index_views">{{ topic.view_count }}</td>
         <td class="forum-index_last_post">
            {% last_post_info topic.last_post %}
         </td>
      </tr>
   {% empty %}
      <tr>
         <td colspan="5">
            <i>No topics available.</i>
         </td>
      </tr>
   {% endfor %}
   </tbody>
</table>
{{ page_nav }}
{% if user.is_authenticated %}
<a href="{% url forums-new_topic slug=forum.slug %}">New Topic</a> &bull;
<form action="{% url forums-catchup slug=forum.slug %}" method="post" style="display:inline">
   <input type="submit" value="Mark All Topics Read" />
</form>
{% endif %}
{% if can_moderate %}
<p><a href="{% url forums-mod_forum slug=forum.slug %}">Moderate this forum</a></p>
{% endif %}
{% current_forum_time user %}
</div>
{% endblock %}