# HG changeset patch # User Brian Neal # 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 %}

Forums: {{ forum.name }}

@@ -28,12 +29,7 @@ {{ topic.user.username }} {{ topic.view_count }} - {% if topic.last_post %} - {{ topic.last_post.update_date|date }}
- {{ topic.last_post.user.username }} - {% else %} - No Posts - {% endif %} + {% last_post_info topic.last_post %} {% 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 %}

Forums

@@ -22,14 +23,7 @@

{{ forum.description }}

{{ forum.topic_count }} {{ forum.post_count }} - - {% if forum.last_post %} - {{ forum.last_post.update_date|date }}
- {{ forum.last_post.user.username }} - {% else %} - No Posts - {% endif %} - + {% last_post_info forum.last_post %} {% endfor %} 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"}}
+{{ post.user.username }} +{% else %} +No posts +{% 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; }