From b148bab8f549792f19ae0256c00c282f29e061dc Mon Sep 17 00:00:00 2001 From: bnewbold Date: Wed, 7 Mar 2007 01:09:52 -0800 Subject: much work; comments working for photos, static content moved, more --- bn_django/git_wiki/models.py | 5 +-- bn_django/git_wiki/templates/git_wiki/item.html | 16 ++++++++ .../photos/templates/photos/photo_detail.html | 17 +++----- bn_django/templates/base.html | 5 +-- bn_django/templates/comment_list | 28 +++++++++++-- bn_django/templates/comments/form.html | 14 +++---- bn_django/templates/comments/free_preview.html | 46 ++++++++++++++++++++++ bn_django/templates/comments/freeform.html | 7 ++-- bn_django/templates/comments/posted.html | 13 ++++++ bn_django/templates/comments/preview.html | 46 ++++++++++++++++++++++ 10 files changed, 165 insertions(+), 32 deletions(-) create mode 100644 bn_django/templates/comments/free_preview.html create mode 100644 bn_django/templates/comments/posted.html create mode 100644 bn_django/templates/comments/preview.html (limited to 'bn_django') diff --git a/bn_django/git_wiki/models.py b/bn_django/git_wiki/models.py index 060e9d5..ad3affb 100644 --- a/bn_django/git_wiki/models.py +++ b/bn_django/git_wiki/models.py @@ -59,6 +59,7 @@ class Tree(models.Model): self.tree_objs = tree_objs self.blob_objs = blob_objs self.all_objs = tree_objs + blob_objs + self.save() class Item(models.Model): @@ -90,7 +91,7 @@ class Item(models.Model): self.contents = commands.getoutput(GITPREFIX + ' cat-file -p ' \ + self.id) self.size = commands.getoutput(GITPREFIX + ' cat-file -s ' + self.id) - return + self.save() class Commit(models.Model): id = models.CharField("hash", maxlength=40,blank=False,primary_key=True) @@ -143,8 +144,6 @@ class Commit(models.Model): self.comment += str(l) + '\n' else: self.comment = '(none)' - return - def fromslug(reqslug): import commands diff --git a/bn_django/git_wiki/templates/git_wiki/item.html b/bn_django/git_wiki/templates/git_wiki/item.html index 16d3518..4258b1c 100644 --- a/bn_django/git_wiki/templates/git_wiki/item.html +++ b/bn_django/git_wiki/templates/git_wiki/item.html @@ -27,3 +27,19 @@
{% endblock %} + +{% block commentary %} +
+{% load comments %} +

Post a comment

+{% if user.is_authenticated %} +{% comment_form for git_wiki.item item.id with is_public yes %} +{% else %} +{% free_comment_form for git_wiki.item item.id with is_public yes %} +{% endif %} +
+{% get_comment_list for git_wiki.item item.id as comments %} +{% get_free_comment_list for git_wiki.item item.id as free_comments %} +{% include "comment_list" %} +
+{% endblock %} diff --git a/bn_django/photos/templates/photos/photo_detail.html b/bn_django/photos/templates/photos/photo_detail.html index 0d5398d..9a7c290 100644 --- a/bn_django/photos/templates/photos/photo_detail.html +++ b/bn_django/photos/templates/photos/photo_detail.html @@ -100,20 +100,15 @@ {% block commentary %}
{% load comments %} - +

Post a comment

{% if user.is_authenticated %} -{% comment_form for photos.photo photo.id with is_public yes %} -comment form:
-{% include "comments/form.html" %} +{% comment_form for photos.photo object.id with is_public yes %} {% else %} -{% free_comment_form for photos.photo photo.id with is_public yes %} -free comment form:
-{% include "comments/freeform.html" %} +{% free_comment_form for photos.photo object.id with is_public yes %} {% endif %} - -comment list:
-{% get_comment_list for photos.photo photo.id as comments %} -{% get_free_comment_list for photos.photo photo.id as free_comments %} +
+{% get_comment_list for photos.photo object.id as comments %} +{% get_free_comment_list for photos.photo object.id as free_comments %} {% include "comment_list" %}
{% endblock %} diff --git a/bn_django/templates/base.html b/bn_django/templates/base.html index 402a959..7349669 100644 --- a/bn_django/templates/base.html +++ b/bn_django/templates/base.html @@ -3,9 +3,8 @@ {% block stylesheets %} - - - + + {% endblock %} {% block externaljs %} {% endblock %} {% block windowtitle %}bryannewbold.com{% endblock %} diff --git a/bn_django/templates/comment_list b/bn_django/templates/comment_list index 8ed411d..ce3ad19 100644 --- a/bn_django/templates/comment_list +++ b/bn_django/templates/comment_list @@ -1,13 +1,33 @@ - {% if comments %} +
{% for c in comments %}
- {{ c.user }} - {{ c.submit_date }} + Posted by {{ c.user }}
+ on + {{ c.submit_date|date:"F j, Y" }}
+ at {{ c.submit_date|date:"H:i T" }}
+ {% if c.headline %} {{ c.headline|escape|wordwrap:80 }} - {{ c.content|escape|wordwrap:80 }} +
+ {% endif %} + {{ c.comment|escape|wordwrap:80 }} + +{% endfor %} +{% for c in free_comments %} +
+ Posted by + {% if c.user %}{{ c.user }}{% else %}anonymous{% endif %}
+ on + {{ c.submit_date|date:"F j, Y" }}
+ at {{ c.submit_date|date:"H:i T" }} +
+ {% if c.headline %} + {{ c.headline|escape|wordwrap:80 }} +
+ {% endif %} + {{ c.comment|escape|wordwrap:80 }} {% endfor %}
diff --git a/bn_django/templates/comments/form.html b/bn_django/templates/comments/form.html index 403dd2b..a2af1be 100644 --- a/bn_django/templates/comments/form.html +++ b/bn_django/templates/comments/form.html @@ -1,11 +1,14 @@ {% load i18n %}
+

+ {% if user.is_authenticated %} -

{% trans "Username:" %} {{ user.username }} ({% trans "Log out" %})

+

 {% trans "Username:" %} {{ user.username }} ({% trans "Log out" %}) {% else %} -


{% trans "Password:" %} ({% trans "Forgotten your password?" %})

+


{% trans "Password:" %} ({% trans "Forgotten your password?" %}) {% endif %} +

{% if ratings_optional or ratings_required %}

{% trans "Ratings" %} ({% if ratings_required %}{% trans "Required" %}{% else %}{% trans "Optional" %}{% endif %}):

@@ -24,13 +27,10 @@ {% endif %} -


-

- - - + +

diff --git a/bn_django/templates/comments/free_preview.html b/bn_django/templates/comments/free_preview.html new file mode 100644 index 0000000..3c212c0 --- /dev/null +++ b/bn_django/templates/comments/free_preview.html @@ -0,0 +1,46 @@ +{% extends "base.html" %} + + +{% block title %}Preview your comment{% endblock %} + +{% block content %} + +
+ {% if comment_form.has_errors %} +

Please correct the following errors.

+ {% else %} +
+ {{ comment.comment|escape|urlizetrunc:"40"|linebreaks }} +

Posted by {{ comment.person_name }}

+
+ +

+ +

Or edit it again

+ {% endif %} + + {% if comment_form.person_name.errors %} + {{ comment_form.person_name.html_error_list }} + {% endif %} + +

{{ comment_form.person_name }}

+ + {% if comment_form.comment.errors %} + {{ comment_form.comment.error_list }} + {% endif %} + +

+ +
+ {{ comment_form.comment }} +

+ + + + + +

+ +

+
+{% endblock %} diff --git a/bn_django/templates/comments/freeform.html b/bn_django/templates/comments/freeform.html index 95e5153..3d3678e 100644 --- a/bn_django/templates/comments/freeform.html +++ b/bn_django/templates/comments/freeform.html @@ -1,11 +1,10 @@ {% load i18n %}
-

-


-

+

+ +

  -

diff --git a/bn_django/templates/comments/posted.html b/bn_django/templates/comments/posted.html new file mode 100644 index 0000000..07bdb67 --- /dev/null +++ b/bn_django/templates/comments/posted.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block title %}Comment posted successfully{% endblock %} + +{% block content %} +

Thanks for contributing.

+ +{% if object %} + +{% endif %} +{% endblock %} diff --git a/bn_django/templates/comments/preview.html b/bn_django/templates/comments/preview.html new file mode 100644 index 0000000..052b373 --- /dev/null +++ b/bn_django/templates/comments/preview.html @@ -0,0 +1,46 @@ +{% extends "base.html" %} + + +{% block title %}Preview your comment{% endblock %} + +{% block content %} + +
+ {% if comment_form.has_errors %} +

Please correct the following errors.

+ {% else %} +
+ {{ comment.comment|escape|urlizetrunc:"40"|linebreaks }} +

Posted by {{ comment.person_name }}

+
+ +

+ +

Or edit it again

+ {% endif %} + + {% if comment_form.person_name.errors %} + {{ comment_form.person_name.html_error_list }} + {% endif %} + +

{{ comment_form.person_name }}

+ + {% if comment_form.comment.errors %} + {{ comment_form.comment.html_error_list }} + {% endif %} + +

+ +
+ {{ comment_form.comment }} +

+ + + + + +

+ +

+
+{% endblock %} -- cgit v1.2.3