Added support for templatetags.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Mon, 10 Aug 2009 00:40:47 +0530
changeset 25 a6a5e45f68c8
parent 24 7257b66a6766
child 26 97bd3c28c957
Added support for templatetags.
app/projrev/views/helpers/templatetags/__init__.py
app/projrev/views/helpers/templatetags/comments_helpers.py
app/settings.py
app/templates/projrev/templatetags/_as_comment.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/projrev/views/helpers/templatetags/__init__.py	Mon Aug 10 00:40:47 2009 +0530
@@ -0,0 +1,7 @@
+"""Module for all the template tags.
+"""
+
+
+__authors__ = [
+  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/projrev/views/helpers/templatetags/comments_helpers.py	Mon Aug 10 00:40:47 2009 +0530
@@ -0,0 +1,19 @@
+"""A Django template tag library containing forms helpers.
+"""
+
+__authors__ = [
+  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
+]
+
+
+from django import template
+
+register = template.Library()
+
+
+@register.inclusion_tag('projrev/templatetags/_as_comment.html')
+def as_comment(user):
+  """Prints a user as a hyperlinked link_id.
+  """
+
+  return {'user': user}
--- a/app/settings.py	Mon Aug 10 00:06:31 2009 +0530
+++ b/app/settings.py	Mon Aug 10 00:40:47 2009 +0530
@@ -94,4 +94,5 @@
     'django.contrib.sites',
     'django.contrib.admin',
     'app.projrev',
+    'app.projrev.views.helpers',
 )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/templates/projrev/templatetags/_as_comment.html	Mon Aug 10 00:40:47 2009 +0530
@@ -0,0 +1,31 @@
+<div class="ghoptaskcomment">
+ <div class="title" id="c{{ comment_id }}">
+  On {{ comment.created_on|date:"jS F Y H:i" }},
+  by
+  {% if comment.created_by %} 
+    {{ comment.created_by.name }}:
+  {% else %}
+    {{ site_name }} Automatic Updater:
+  {% endif %}
+  <span class="spc{{ comment_id }}">
+   <a title="Permalink to this Comment" href="#c{{ comment_id }}">ΒΆ</a>
+  </span>
+ </div>
+ <div class="box-inner">
+  <p>
+   {% if comment.content %}
+     {{ comment.content|safe }}</p>
+   {% else %}
+   (No Comment was entered for this change.)
+   {% endif %}
+ </div>
+ {% if comment.changes %}
+  <div class="changes">
+   <div class="box-inner">
+    <b>Changes:</b>
+    {{ comment.changes|join:"; " }} 
+   </div>
+  </div>
+ {% endif %}
+</div>
+<hr />
\ No newline at end of file