diff options
author | bnewbold <bnewbold@manus.(none)> | 2007-03-07 01:09:52 -0800 |
---|---|---|
committer | bnewbold <bnewbold@manus.(none)> | 2007-03-07 01:09:52 -0800 |
commit | b148bab8f549792f19ae0256c00c282f29e061dc (patch) | |
tree | e08cccaa5257e77faea258891cfd3974ec641ba8 | |
parent | 3a454ef090f5afe3d0ddf119afa0ca6312e52c3b (diff) | |
download | bnewnet-b148bab8f549792f19ae0256c00c282f29e061dc.tar.gz bnewnet-b148bab8f549792f19ae0256c00c282f29e061dc.zip |
much work; comments working for photos, static content moved, more
-rw-r--r-- | bn_django/git_wiki/models.py | 5 | ||||
-rw-r--r-- | bn_django/git_wiki/templates/git_wiki/item.html | 16 | ||||
-rw-r--r-- | bn_django/photos/templates/photos/photo_detail.html | 17 | ||||
-rw-r--r-- | bn_django/templates/base.html | 5 | ||||
-rw-r--r-- | bn_django/templates/comment_list | 28 | ||||
-rw-r--r-- | bn_django/templates/comments/form.html | 14 | ||||
-rw-r--r-- | bn_django/templates/comments/free_preview.html | 46 | ||||
-rw-r--r-- | bn_django/templates/comments/freeform.html | 7 | ||||
-rw-r--r-- | bn_django/templates/comments/posted.html | 13 | ||||
-rw-r--r-- | bn_django/templates/comments/preview.html | 46 | ||||
-rw-r--r-- | static/style/commentary.css | 45 | ||||
-rw-r--r-- | static/style/default.css | 4 | ||||
-rw-r--r-- | static/style/git_browse.css | 2 |
13 files changed, 211 insertions, 37 deletions
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 @@ </span> <br /> {% endblock %} + +{% block commentary %} +<div class="content" id="commentary"> +{% load comments %} +<h3>Post a comment</h3> +{% 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 %} +<br /> +{% 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" %} +</div> +{% 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 %} <div class="content" id="commentary"> {% load comments %} - +<h3>Post a comment</h3> {% if user.is_authenticated %} -{% comment_form for photos.photo photo.id with is_public yes %} -comment form:<br /> -{% 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:<br /> -{% include "comments/freeform.html" %} +{% free_comment_form for photos.photo object.id with is_public yes %} {% endif %} - -comment list:<br /> -{% get_comment_list for photos.photo photo.id as comments %} -{% get_free_comment_list for photos.photo photo.id as free_comments %} +<br /> +{% 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" %} </div> {% 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 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head> {% block stylesheets %} -<link rel="STYLESHEET" type="text/css" href="style/default.css" /> -<link rel="STYLESHEET" type="text/css" href="/style/default.css" /> -<!--<link rel="STYLESHEET" type="text/css" href="http://static.bryannewbold.com/style/default.css" /> --> +<link rel="STYLESHEET" type="text/css" href="/static/style/default.css" /> +<link rel="STYLESHEET" type="text/css" href="/static/style/commentary.css" /> {% endblock %} {% block externaljs %} {% endblock %} <title>{% block windowtitle %}bryannewbold.com{% endblock %}</title> 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 %} +<br /> <table class="comments"> {% for c in comments %} <tr><td class="comment_info"> - <span class="comment_user">{{ c.user }}</span> - <span class="comment_date">{{ c.submit_date }}</span> + Posted by <span class="comment_user">{{ c.user }}</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> </td><td class="comment_content"> + {% if c.headline %} <span class="comment_headline">{{ c.headline|escape|wordwrap:80 }}</span> - <span class="comment_content">{{ c.content|escape|wordwrap:80 }}</span> + <br /> + {% endif %} + <span class="comment_content">{{ c.comment|escape|wordwrap:80 }}</span> +</td</tr> +{% endfor %} +{% for c in free_comments %} +<tr><td class="comment_info"> + Posted by <span class="comment_user"> + {% if c.user %}{{ c.user }}{% else %}anonymous{% 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> + </td><td class="comment_content"> + {% if c.headline %} + <span class="comment_headline">{{ c.headline|escape|wordwrap:80 }}</span> + <br /> + {% endif %} + <span class="comment_content">{{ c.comment|escape|wordwrap:80 }}</span> </td</tr> {% endfor %} </table> 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 %} <form {% if photos_optional or photos_required %}enctype="multipart/form-data" {% endif %}action="/comments/post/" method="post"> +<p><textarea name="comment" id="id_comment"></textarea></p> +<input class="submit" type="submit" name="preview" value="{% trans "Preview comment" %}" /> {% if user.is_authenticated %} -<p>{% trans "Username:" %} <strong>{{ user.username }}</strong> (<a href="/accounts/logout/">{% trans "Log out" %}</a>)</p> +<p> {% trans "Username:" %} <strong>{{ user.username }}</strong> (<a href="/accounts/logout/">{% trans "Log out" %}</a>) {% else %} -<p><label for="id_username">{% trans "Username:" %}</label> <input type="text" name="username" id="id_username" /><br />{% trans "Password:" %} <input type="password" name="password" id="id_password" /> (<a href="/accounts/password_reset/">{% trans "Forgotten your password?" %}</a>)</p> +<p><label for="id_username">{% trans "Username:" %}</label> <input type="text" name="username" id="id_username" /><br />{% trans "Password:" %} <input type="password" name="password" id="id_password" /> (<a href="/accounts/password_reset/">{% trans "Forgotten your password?" %}</a>) {% endif %} +</p> {% if ratings_optional or ratings_required %} <p>{% trans "Ratings" %} ({% if ratings_required %}{% trans "Required" %}{% else %}{% trans "Optional" %}{% endif %}):</p> @@ -24,13 +27,10 @@ <input type="hidden" name="photo_options" value="{{ photo_options }}" /> {% endif %} -<p><label for="id_comment">{% trans "Comment:" %}</label><br /> -<textarea name="comment" id="id_comment" rows="10" cols="60"></textarea></p> <p> <input type="hidden" name="options" value="{{ options }}" /> -<input type="hidden" name="target" value="{{ target }}{{object.type}}:{{object.id}}" /> -<input type="hidden" name="gonzo" value="{{ hash }}asdf" /> -<input type="submit" name="preview" value="{% trans "Preview comment" %}" /> +<input type="hidden" name="target" value="{{ target }}" /> +<input type="hidden" name="gonzo" value="{{ hash }}" /> </p> </form> 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 %} + +<form action="../postfree/" method="post"> + {% if comment_form.has_errors %} + <p><strong style="color: red;">Please correct the following errors.</strong></p> + {% else %} + <div class="comment"> + {{ comment.comment|escape|urlizetrunc:"40"|linebreaks }} + <p class="date small">Posted by <strong>{{ comment.person_name }}</strong></p> + </div> + + <p><input type="submit" name="post" value="Post public comment" /></p> + + <h1>Or edit it again</h1> + {% endif %} + + {% if comment_form.person_name.errors %} + {{ comment_form.person_name.html_error_list }} + {% endif %} + + <p><label for="id_person_name">Your name:</label> {{ comment_form.person_name }}</p> + + {% if comment_form.comment.errors %} + {{ comment_form.comment.error_list }} + {% endif %} + + <p> + <label for="id_comment">Comment:</label> + <br /> + {{ comment_form.comment }} + </p> + + <input type="hidden" name="options" value="{{ options }}" /> + <input type="hidden" name="target" value="{{ target }}" /> + <input type="hidden" name="gonzo" value="{{ hash }}" /> + + <p> + <input type="submit" name="preview" value="Preview revised comment" /> + </p> +</form> +{% 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 %} <form action="/comments/postfree/" method="post"> -<p><label for="id_person_name">{% trans "Your name:" %}</label> <input type="text" id="id_person_name" name="person_name" /></p> -<p><label for="id_comment">{% trans "Comment:" %}</label><br /><textarea name="comment" id="id_comment" rows="10" cols="60"></textarea></p> -<p> +<p><textarea name="comment" id="id_comment" rows="10" cols="60"></textarea></p> +<input class="submit" type="submit" name="preview" value="{% trans "Preview comment" %}" /> +<p> <label for="id_person_name">{% trans "Your name:" %}</label> <input type="text" id="id_person_name" name="person_name" /> <input type="hidden" name="options" value="{{ options }}" /> <input type="hidden" name="target" value="{{ target }}" /> <input type="hidden" name="gonzo" value="{{ hash }}" /> -<input type="submit" name="preview" value="{% trans "Preview comment" %}" /> </p> </form> 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 %} +<p>Thanks for contributing.</p> + +{% if object %} + <ul> + <li><a href="{{ object.get_absolute_url }}">View your comment</a></li> + </ul> +{% 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 %} + +<form action="../post/" method="post"> + {% if comment_form.has_errors %} + <p><strong style="color: red;">Please correct the following errors.</strong></p> + {% else %} + <div class="comment"> + {{ comment.comment|escape|urlizetrunc:"40"|linebreaks }} + <p class="date small">Posted by <strong>{{ comment.person_name }}</strong></p> + </div> + + <p><input type="submit" name="post" value="Post public comment" /></p> + + <h1>Or edit it again</h1> + {% endif %} + + {% if comment_form.person_name.errors %} + {{ comment_form.person_name.html_error_list }} + {% endif %} + + <p><label for="id_person_name">Your name:</label> {{ comment_form.person_name }}</p> + + {% if comment_form.comment.errors %} + {{ comment_form.comment.html_error_list }} + {% endif %} + + <p> + <label for="id_comment">Comment:</label> + <br /> + {{ comment_form.comment }} + </p> + + <input type="hidden" name="options" value="{{ options }}" /> + <input type="hidden" name="target" value="{{ target }}" /> + <input type="hidden" name="gonzo" value="{{ hash }}" /> + + <p> + <input type="submit" name="preview" value="Preview revised comment" /> + </p> +</form> +{% 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%; |