mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
added comment metadata to frontend
This commit is contained in:
parent
0f98c779c0
commit
d77cbf3043
BIN
sphinx/themes/basic/static/comment-bright.png
Normal file
BIN
sphinx/themes/basic/static/comment-bright.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
@ -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',
|
||||
|
@ -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'))
|
||||
|
Loading…
Reference in New Issue
Block a user