added comment metadata to frontend

This commit is contained in:
Jacob Mason 2010-08-09 19:07:18 -05:00
parent 0f98c779c0
commit d77cbf3043
3 changed files with 9 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -617,9 +617,14 @@
*/
$.fn.comment = function() {
return this.each(function() {
var id = $(this).attr('id').substring(1);
var count = COMMENT_METADATA[id]
var title = count + ' comment' + (count == 1 ? '' : 's');
var image = count > 0 ? opts.commentBrightImage : opts.commentImage;
$(this).append(
$('<a href="#" class="sphinx_comment"></a>')
.html('<img src="' + opts.commentImage + '" alt="comment" />')
.html('<img src="' + image + '" alt="comment" />')
.attr('title', title)
.click(function(event) {
event.preventDefault();
show($(this).parent().attr('id'));
@ -727,6 +732,7 @@
rejectCommentURL: '/reject_comment',
rejectCommentURL: '/delete_comment',
commentImage: '/static/_static/comment.png',
commentBrightImage: '/static/_static/comment-bright.png',
upArrow: '/static/_static/up.png',
downArrow: '/static/_static/down.png',
upArrowPressed: '/static/_static/up-pressed.png',

View File

@ -371,6 +371,8 @@ class WebSupport(object):
if self.staticdir != 'static':
p = lambda file: '%s/_static/%s' % (self.staticdir, file)
parts.append('commentImage: "/%s",' % p('comment.png') )
parts.append(
'commentBrightImage: "/%s",' % p('comment-bright.png') )
parts.append('upArrow: "/%s",' % p('up.png'))
parts.append('downArrow: "/%s",' % p('down.png'))
parts.append('upArrowPressed: "/%s",' % p('up-pressed.png'))