From 296dc07f010d8692028db682d02ef3e88e525f01 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sun, 25 Jan 2009 11:03:03 -0500 Subject: tweaked comment templates some more --- bn_django/journal/models.py | 3 + .../journal/templates/journal/entry_detail.html | 4 +- bn_django/templates/comment_list | 3 +- bn_django/templates/comments/form.html | 15 +++-- bn_django/templates/comments/posted.html | 8 +++ bn_django/templates/comments/preview.html | 72 ++++++++++++++++++++++ static/style/commentary.css | 7 ++- 7 files changed, 99 insertions(+), 13 deletions(-) create mode 100644 bn_django/templates/comments/posted.html create mode 100644 bn_django/templates/comments/preview.html diff --git a/bn_django/journal/models.py b/bn_django/journal/models.py index 962efee..8836122 100644 --- a/bn_django/journal/models.py +++ b/bn_django/journal/models.py @@ -32,6 +32,9 @@ class Entry(JournalCommon): title = models.CharField("entry title", max_length=384) slug = models.SlugField() + def get_absolute_url(self): + return "/journal/%s/"%self.slug + class MicroEntry(JournalCommon): html_content = models.TextField("html format content", blank=False) text_content = models.TextField("text version of content", blank=True,null=True) diff --git a/bn_django/journal/templates/journal/entry_detail.html b/bn_django/journal/templates/journal/entry_detail.html index 45edd4b..9c74ed6 100644 --- a/bn_django/journal/templates/journal/entry_detail.html +++ b/bn_django/journal/templates/journal/entry_detail.html @@ -23,9 +23,9 @@ {% block commentary %}
-

Post a comment

-{% render_comment_form for object %} {% get_comment_list for object as comments %} {% include "comment_list" %} +

Post a comment

+{% render_comment_form for object %}
{% endblock %} diff --git a/bn_django/templates/comment_list b/bn_django/templates/comment_list index dad1de5..0629541 100644 --- a/bn_django/templates/comment_list +++ b/bn_django/templates/comment_list @@ -10,7 +10,7 @@ {% else %}{{ c.user_name }} {% endif %}
on {{ c.submit_date|date:"F j, Y" }}
- at {{ c.submit_date|date:"H:i T" }} + at {{ c.submit_date|date:"H:i" }} {% if c.headline %} {{ c.headline|escape|wordwrap:80 }} @@ -35,6 +35,7 @@ {% endfor %} +

{% else %}

No comments yet!

{% endif %} diff --git a/bn_django/templates/comments/form.html b/bn_django/templates/comments/form.html index 67068e8..39626f0 100644 --- a/bn_django/templates/comments/form.html +++ b/bn_django/templates/comments/form.html @@ -1,23 +1,22 @@ {% load comments i18n %}
- {% for field in form %} - {% if field.is_hidden %} {{ field }} {% else %} +{% if object.get_absolute_url %} {% endif %} + {% for field in form %} {% if field.is_hidden %} {{ field }} {% else %} {% ifequal field.name "honeypot" %} {{ field.label_tag }}{{ field }} {% else %} - - {% endifequal %} - {% endif %} - {% endfor %} + {{ field.label_tag }} + {% endifequal %} {% endif %} {% endfor %}
{% if field.errors %}{{ field.errors }}{% endif %} - {{ field.label_tag }}{{ field }} -
{{ field }} + {% ifequal field.name "name" %} (required) {% else %}{% ifequal field.name "email" %} (required){% endifequal %}{% endifequal %} +
+ (no HTML or other markup)
diff --git a/bn_django/templates/comments/posted.html b/bn_django/templates/comments/posted.html new file mode 100644 index 0000000..e3eb0d2 --- /dev/null +++ b/bn_django/templates/comments/posted.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{% trans "Thanks for your comment" %}.{% endblock %} + +{% block content %} +
+{% endblock %} diff --git a/bn_django/templates/comments/preview.html b/bn_django/templates/comments/preview.html new file mode 100644 index 0000000..cf49370 --- /dev/null +++ b/bn_django/templates/comments/preview.html @@ -0,0 +1,72 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{% trans "Comment Submission" %}{% endblock %} + +{% block content %}
+
+ {% load comments %} +
+ {% if form.errors %} +

{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}

+ {% else %} +

{% trans "Preview your comment:" %}

+ + +{% if comment.person_name %} + +{% else %} + +{% endif %} +
+ Posted by + {% if comment.person_name %}{{ comment.person_name}}{% else %}anonymous{% endif %}
+ on + {{ comment.submit_date|date:"F j, Y" }}
+ at {{ comment.submit_date|date:"H:i T" }} +
+ {% if comment.headline %} + {{ comment.headline|escape|wordwrap:80 }} +
+ {% endif %} + {{ comment|escape|wordwrap:80 }} +
+ Posted by + {% if comment.user.username %} {{ comment.user.username }} + {% else %}{{ comment.user_name }} {% endif %}
+ on + {{ comment.submit_date|date:"F j, Y" }}
+ at {{ comment.submit_date|date:"H:i" }} +
+ {% if comment.headline %} + {{ comment.headline|escape|wordwrap:80 }} +
+ {% endif %} + {{ comment|escape|wordwrap:80 }} +
+ + + +

+ {% trans "and" %} {% trans "or make changes" %}: +

+ {% endif %} + + {% for field in form %} {% if field.is_hidden %} {{ field }} {% else %} + {% ifequal field.name "honeypot" %} + {{ field.label_tag }}{{ field }} + {% else %} + {% endifequal %} {% endif %} {% endfor %} + +
+ + {{ field.label_tag }} + {{ field }} + {% if field.errors %}{{ field.errors }}{% endif %} +
+ + + (no HTML or other markup) +
+ +{% endblock %} diff --git a/static/style/commentary.css b/static/style/commentary.css index a65eb76..abe2ec4 100644 --- a/static/style/commentary.css +++ b/static/style/commentary.css @@ -19,7 +19,7 @@ padding: 2px; border: 1px solid black; margin-top: 3px; -} + width: 200px; } #commentary form input.submit-post { border: 1px solid black; width: 110px; @@ -31,13 +31,16 @@ width: 110px; background-color: greenyellow; margin-top: 0px; } - #commentary form td.comment_field_name { width: 250px; vertical-align: top; padding-top: 7px; padding-right: 7px; text-align: right; } +#commentary form ul.errorlist { + margin: 5px; + color: red; + font-weight: bold;} #commentary table { width: 93%; -- cgit v1.2.3