diff options
author | bnewbold <bnewbold@eta.mit.edu> | 2009-01-25 11:03:03 -0500 |
---|---|---|
committer | bnewbold <bnewbold@eta.mit.edu> | 2009-01-25 11:03:03 -0500 |
commit | 296dc07f010d8692028db682d02ef3e88e525f01 (patch) | |
tree | 2a40e74323a42ff18f4fb878db9b23239009fe89 | |
parent | 17dd049b947cb447628002bae3068581733565f1 (diff) | |
download | bnewnet-296dc07f010d8692028db682d02ef3e88e525f01.tar.gz bnewnet-296dc07f010d8692028db682d02ef3e88e525f01.zip |
tweaked comment templates some more
-rw-r--r-- | bn_django/journal/models.py | 3 | ||||
-rw-r--r-- | bn_django/journal/templates/journal/entry_detail.html | 4 | ||||
-rw-r--r-- | bn_django/templates/comment_list | 3 | ||||
-rw-r--r-- | bn_django/templates/comments/form.html | 15 | ||||
-rw-r--r-- | bn_django/templates/comments/posted.html | 8 | ||||
-rw-r--r-- | bn_django/templates/comments/preview.html | 72 | ||||
-rw-r--r-- | static/style/commentary.css | 7 |
7 files changed, 99 insertions, 13 deletions
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 %} <div class='content' id='commentary'> -<h3>Post a comment</h3> -{% render_comment_form for object %} {% get_comment_list for object as comments %} {% include "comment_list" %} +<h3>Post a comment</h3> +{% render_comment_form for object %} </div> {% 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 %}</span><br /> on <span class="comment_date"> {{ c.submit_date|date:"F j, Y" }}</span><br /> - at <span class="comment_time">{{ c.submit_date|date:"H:i T" }}</span> + at <span class="comment_time">{{ c.submit_date|date:"H:i" }}</span> </td><td class="comment_content"> {% if c.headline %} <span class="comment_headline">{{ c.headline|escape|wordwrap:80 }}</span> @@ -35,6 +35,7 @@ </td></tr> {% endfor %} </table> +<br /><br /> {% else %} <h3>No comments yet!</h3> {% 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 %} <form action="{% comment_form_target %}" method="post"> <table> - {% for field in form %} - {% if field.is_hidden %} {{ field }} {% else %} +{% if object.get_absolute_url %} <input type="hidden" name="next" value="{{ object.get_absolute_url }}" />{% endif %} + {% for field in form %} {% if field.is_hidden %} {{ field }} {% else %} {% ifequal field.name "honeypot" %} <span style="display:none;">{{ field.label_tag }}{{ field }}</span> {% else %} - <tr><td class="comment_field_name"> <span {% if field.errors %} class="error"{% endif %}> {% if field.errors %}{{ field.errors }}{% endif %} - {{ field.label_tag }}</span></td><td>{{ field }} -</td></tr> - {% endifequal %} - {% endif %} - {% endfor %} + {{ field.label_tag }} + </span></td><td>{{ field }} + {% ifequal field.name "name" %} <i>(required)</i> {% else %}{% ifequal field.name "email" %} <i>(required)</i>{% endifequal %}{% endifequal %} +</td></tr> {% endifequal %} {% endif %} {% endfor %} <tr><td class="comment_field_name"></td><td> <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" /> <input type="submit" name="post" class="submit-post" value="{% trans "Post" %}" /> + <i>(no HTML or other markup)</i> </td></tr> </table> </form> 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 %} +<br /> +{% 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 %}</div><div class='content' id='commentary'> +<br /> + {% load comments %} + <form action="{% comment_form_target %}" method="post"> + {% if form.errors %} + <h4>{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}</h4> + {% else %} + <h4>{% trans "Preview your comment:" %}</h4> + +<table class="comments"> +{% if comment.person_name %} +<tr><td class="comment_info"> + Posted by <span class="comment_user"> + {% if comment.person_name %}{{ comment.person_name}}{% else %}anonymous{% endif %}</span><br /> + on <span class="comment_date"> + {{ comment.submit_date|date:"F j, Y" }}</span><br /> + at <span class="comment_time">{{ comment.submit_date|date:"H:i T" }}</span> + </td><td class="comment_content"> + {% if comment.headline %} + <span class="comment_headline">{{ comment.headline|escape|wordwrap:80 }}</span> + <br /> + {% endif %} + <span class="comment_content">{{ comment|escape|wordwrap:80 }}</span> +</td></tr> +{% else %} +<tr><td class="comment_info"> + Posted by <span class="comment_user"> + {% if comment.user.username %} {{ comment.user.username }} + {% else %}{{ comment.user_name }} {% endif %}</span><br /> + on <span class="comment_date"> + {{ comment.submit_date|date:"F j, Y" }}</span><br /> + at <span class="comment_time">{{ comment.submit_date|date:"H:i" }}</span> + </td><td class="comment_content"> + {% if comment.headline %} + <span class="comment_headline">{{ comment.headline|escape|wordwrap:80 }}</span> + <br /> + {% endif %} + <span class="comment_content">{{ comment|escape|wordwrap:80 }}</span> +</td></tr> +{% endif %} +</table> + + + + <p> + {% trans "and" %} <input type="submit" name="submit" class="submit-post" value="{% trans "Post your comment" %}" id="submit" /> {% trans "or make changes" %}: + </p> + {% endif %} +<table> + {% for field in form %} {% if field.is_hidden %} {{ field }} {% else %} + {% ifequal field.name "honeypot" %} + <span style="display:none;">{{ field.label_tag }}{{ field }}</span> + {% else %} +<tr><td class="comment_field_name"> + <span {% if field.errors %} class="error"{% endif %}> + {{ field.label_tag }} + </span></td><td>{{ field }} + {% if field.errors %}{{ field.errors }}{% endif %} +</td></tr> {% endifequal %} {% endif %} {% endfor %} +<tr><td class="comment_field_name"></td><td> + <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" /> + <input type="submit" name="post" class="submit-post" value="{% trans "Post" %}" /> + <i>(no HTML or other markup)</i> +</td></tr> +</table> + +{% 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%; |