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 ++++++++++++++++++++++ static/style/commentary.css | 45 +++++++++++++++++++++ static/style/default.css | 4 -- static/style/git_browse.css | 2 +- 13 files changed, 211 insertions(+), 37 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 create mode 100644 static/style/commentary.css 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 %} diff --git a/static/style/commentary.css b/static/style/commentary.css new file mode 100644 index 0000000..584e6f1 --- /dev/null +++ b/static/style/commentary.css @@ -0,0 +1,45 @@ +#commentary { + background-color: #b7c6ff; + border-top: 2px solid #000000; } + +#commentary p { + margin-left: 15px; } +#commentary h3 { + font-style: italic; + padding-left: 280px; + width: 100%; } +#commentary hr { + border-color: #b7c6ff; } +#commentary form textarea { + width: 640px; + padding: 2px; + border: 1px solid black; + height: 120px; } +#commentary form input { + padding: 2px; + border: 1px solid black; + margin-top: 3px; +} +#commentary form input.submit { + margin-top: 4px; + margin-right: 19px; + float: right; + border: 1px solid black; + width: 180px; } + +#commentary table { + width: 93%; + margin-left: 15px; + border-spacing: 0px 6px; } +#commentary table td.comment_info { + width: 115px; + vertical-align: top; + padding-right: 8px; + font-style: italic; + font-size: 11px; + text-align: right; } +#commentary table td.comment_content { + border-left: 3px solid #3756af; + padding-left: 10px; } +#commentary table span.comment_headline { + font-weight: bold; } diff --git a/static/style/default.css b/static/style/default.css index 1a3a938..513f064 100644 --- a/static/style/default.css +++ b/static/style/default.css @@ -205,10 +205,6 @@ table.listing td.date { table.listing td.description { overflow: hidden; } -#commentary { - background-color: #a9afdc; - background-color: #c7c6ff; - border-top: 2px solid #000000; } #top_bar { height: 22px; background-color: #993333; diff --git a/static/style/git_browse.css b/static/style/git_browse.css index 2772a07..6c3fb48 100644 --- a/static/style/git_browse.css +++ b/static/style/git_browse.css @@ -8,7 +8,7 @@ pre.large { table.gitbrowser { width: 100%; - border-spacing: 0px; + border-spacing: 0px 2px; font-size: 11px; } table.gitbrowser tr { width: 100%; -- cgit v1.2.3