commit 728be4bd70c7f65f4b54dcdb712d37d7c5aae8e2
parent c2c02a9a965373fd61af1b388ed9ede8ef1eca87
Author: Dan Callaghan <djc@djc.id.au>
Date: Wed, 3 Dec 2008 19:27:40 +1000
moved comments out to single/multiple
Diffstat:
4 files changed, 81 insertions(+), 28 deletions(-)
diff --git a/static/css/common.css b/static/css/common.css
@@ -10,7 +10,7 @@ body {
border-bottom: 1px dashed #aaa;
background-color: white;
margin: 0;
- padding: 0.001em 1em;
+ padding: 0.01em 1em 1em 2em;
}
#content {
margin: 1em auto;
@@ -57,7 +57,8 @@ div.blocksep {
/* Styles which are common to all item types */
.item {
- padding: 2em 0;
+ margin-top: 2em;
+ padding-top: 2em;
clear: both;
border-top: 1px solid #ddd;
}
@@ -78,6 +79,14 @@ div.blocksep {
.item .date a {
color: #888;
}
+.commentslink {
+ text-align: right;
+ font-style: italic;
+}
+.commentslink a {
+ color: #888;
+ white-space: nowrap;
+}
/* Blog entries */
.BlogEntry h3 {
@@ -95,14 +104,6 @@ div.blocksep {
color: black;
white-space: nowrap;
}
-.BlogEntry .commentslink {
- text-align: right;
- font-style: italic;
-}
-.BlogEntry .commentslink a {
- color: #888;
- white-space: nowrap;
-}
/* Reading log entries */
.ReadingLogEntry h3 {
@@ -126,33 +127,33 @@ div.blocksep {
}
/* Comments */
-.entry .commentblock {
+.commentblock {
margin: 2em 4em 0 4em;
font-size: 0.9em;
}
-.entry .commentblock h4 {
+.commentblock h4 {
font-size: 1.2em;
}
-.entry .commentblock .commentmeta {
+.commentblock .commentmeta {
text-align: right;
}
-.entry .commentblock .commentmeta .commentdatetime {
+.commentblock .commentmeta .commentdatetime {
color: #888;
margin: 0 0.5em;
}
-.entry .commentblock .commentmeta .permalink {
+.commentblock .commentmeta .permalink {
color: #888;
}
/* Comment form */
-.entry .commentform label {
+.commentform label {
display: block;
}
-.entry .commentform input {
+.commentform input {
display: block;
width: 30em;
}
-.entry .commentform textarea {
+.commentform textarea {
width: 100%;
font-size: 1em;
}
diff --git a/templates/html/BlogEntry.xml b/templates/html/BlogEntry.xml
@@ -25,14 +25,4 @@ from recaptcha.client import captcha
${markdown(item.body)}
</div>
-<!-- XXX comments -->
-
-<div class="commentslink" py:if="item.has_comments()">
- <!-- XXX script_name --><a href="${item.uri_path}#comments" py:choose="len(item.comments())">
- <py:when test="0">no comments »</py:when>
- <py:when test="1">1 comment »</py:when>
- <py:otherwise>${len(item.comments())} comments »</py:otherwise>
- </a>
-</div>
-
</div>
diff --git a/templates/html/multiple.xml b/templates/html/multiple.xml
@@ -23,6 +23,14 @@ sorted_items = sorted(items, key=lambda item: item.publication_date, reverse=Tru
<py:for each="item in (defined('offset') and sorted_items[offset:offset + config.getint('global', 'items_per_page')] or sorted_items)">
${item.render('text/html')}
+
+ <div class="commentslink" py:if="item.has_comments()">
+ <!-- XXX script_name --><a href="${item.uri_path}#comments" py:choose="len(item.comments())">
+ <py:when test="0">no comments »</py:when>
+ <py:when test="1">1 comment »</py:when>
+ <py:otherwise>${len(item.comments())} comments »</py:otherwise>
+ </a>
+ </div>
</py:for>
<p id="prevnextlinks"
diff --git a/templates/html/single.xml b/templates/html/single.xml
@@ -5,6 +5,11 @@
lang="en-AU">
<xi:include href="_commonwrapper.xml" />
+<?python
+from viewutils import markdown
+from recaptcha.client import captcha
+?>
+
<head>
<title>${item.title}</title>
</head>
@@ -12,5 +17,54 @@
${item.render('text/html')}
+<div id="comments" class="commentblock" py:if="item.has_comments()"
+ py:with="comments = sorted(item.comments(), key=lambda c: c.date)">
+
+ <h4 class="comments" py:choose="len(comments)">
+ <py:when test="0">No comments</py:when>
+ <py:when test="1">1 comment</py:when>
+ <py:otherwise>${len(entry.comments())} comments</py:otherwise>
+ </h4>
+ <div py:for="n, comment in enumerate(comments)" id="comment-${comment.id}">
+ ${markdown(comment.body, safe_mode='escape')}
+ <p class="commentmeta">
+
+ ― <a py:strip="not comment.author_url" href="${comment.author_url}">${comment.author_name()}</a>
+ <span class="commentdatetime">${comment.date.strftime(str('%-1d %b %Y %H:%M'))}</span>
+ <a href="#comment-${comment.id}" class="permalink" title="permalink">#</a>
+ </p>
+ ${block_sep()}
+ </div>
+ <div class="commentform"><form method="post" action="${item.uri_path}/comments/+new"><!-- XXX script_name -->
+
+ <p>
+ <label for="commentform-from">Name</label>
+ <input type="text" id="commentform-from" name="from" />
+ </p>
+ <p>
+ <label for="commentform-author-email">E-mail address (not published)</label>
+ <input type="text" id="commentform-author-email" name="author-email" />
+ </p>
+
+ <p>
+ <label for="commentform-author-url">URL</label>
+ <input type="text" id="commentform-author-url" name="author-url" />
+ </p>
+ <p>
+ <label for="commentform-comment">Comment (use <a href="http://daringfireball.net/projects/markdown/syntax">Markdown</a>, no HTML)</label>
+ <textarea id="commentform-comment" name="comment" rows="7" cols="30"></textarea>
+
+ </p>
+ <py:if test="config.getboolean('blog', 'require_captcha')">
+ <script type="text/javascript">
+ RecaptchaOptions = {theme: 'white'};
+ </script>
+ ${Markup(captcha.displayhtml(config.get('blog', 'recaptcha_pubkey')))}
+ </py:if>
+ <p><button type="submit">Submit</button></p>
+ </form></div>
+
+</div>
+
</body>
</html>