# HG changeset patch # User Brian Neal <bgneal@gmail.com> # Date 1251583300 0 # Node ID 9e5e52556d5b5300f3724f84aae97f6f0ea4032a # Parent 5b4c812b448e81aa78990a9929fa5caa47576c62 Forums: added a last_post_info template tag. Still need to add a go to last post icon for it. diff -r 5b4c812b448e -r 9e5e52556d5b gpp/forums/templatetags/forum_tags.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/forums/templatetags/forum_tags.py Sat Aug 29 22:01:40 2009 +0000 @@ -0,0 +1,11 @@ +""" +Template tags for the forums application. +""" +from django import template + +register = template.Library() + + +@register.inclusion_tag('forums/last_post_info.html') +def last_post_info(post): + return {'post': post} diff -r 5b4c812b448e -r 9e5e52556d5b gpp/templates/forums/forum_index.html --- a/gpp/templates/forums/forum_index.html Sat Aug 29 20:54:16 2009 +0000 +++ b/gpp/templates/forums/forum_index.html Sat Aug 29 22:01:40 2009 +0000 @@ -1,4 +1,5 @@ {% extends 'base.html' %} +{% load forum_tags %} {% block title %}Forums: {{ forum.name }}{% endblock %} {% block content %} <h2>Forums: {{ forum.name }}</h2> @@ -28,12 +29,7 @@ <td class="forum-index_author">{{ topic.user.username }}</td> <td class="forum-index_views">{{ topic.view_count }}</td> <td class="forum-index_last_post"> - {% if topic.last_post %} - {{ topic.last_post.update_date|date }}<br /> - {{ topic.last_post.user.username }} - {% else %} - <i>No Posts</i> - {% endif %} + {% last_post_info topic.last_post %} </td> </tr> {% empty %} diff -r 5b4c812b448e -r 9e5e52556d5b gpp/templates/forums/index.html --- a/gpp/templates/forums/index.html Sat Aug 29 20:54:16 2009 +0000 +++ b/gpp/templates/forums/index.html Sat Aug 29 22:01:40 2009 +0000 @@ -1,4 +1,5 @@ {% extends 'base.html' %} +{% load forum_tags %} {% block title %}Forums{% endblock %} {% block content %} <h2>Forums</h2> @@ -22,14 +23,7 @@ <p>{{ forum.description }}</p></td> <td class="forum-topics">{{ forum.topic_count }}</td> <td class="forum-posts">{{ forum.post_count }}</td> - <td class="forum-last_post"> - {% if forum.last_post %} - {{ forum.last_post.update_date|date }}<br /> - {{ forum.last_post.user.username }} - {% else %} - <i>No Posts</i> - {% endif %} - </td> + <td class="forum-last_post">{% last_post_info forum.last_post %}</td> </tr> {% endfor %} </tbody> diff -r 5b4c812b448e -r 9e5e52556d5b gpp/templates/forums/last_post_info.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/forums/last_post_info.html Sat Aug 29 22:01:40 2009 +0000 @@ -0,0 +1,6 @@ +{% if post %} +{{ post.update_date|date:"M d, Y H:i"}}<br /> +<a href="{% url bio-view_profile username=post.user.username %}" title="View profile for {{ post.user.username }}">{{ post.user.username }}</a> +{% else %} +<i>No posts</i> +{% endif %} diff -r 5b4c812b448e -r 9e5e52556d5b media/css/base.css --- a/media/css/base.css Sat Aug 29 20:54:16 2009 +0000 +++ b/media/css/base.css Sat Aug 29 22:01:40 2009 +0000 @@ -160,7 +160,7 @@ background:teal; } table.forum-index-table .forum-title { - width:65%; + width:60%; } table.forum-index-table .forum-topics { width:10%; @@ -171,12 +171,12 @@ text-align:center; } table.forum-index-table .forum-last_post { - width:15%; + width:20%; text-align:center; } table.forum-index-table .forum-index_title { - width:55%; + width:50%; } table.forum-index-table .forum-index_replies { width:10%; @@ -191,6 +191,6 @@ text-align:center; } table.forum-index-table .forum-index_last_post { - width:15%; + width:20%; text-align:center; }