Skip to content

Commit 1e881e1

Browse files
committed
评论层级样式修改 close liangliangyy#212
1 parent 0832177 commit 1e881e1

File tree

2 files changed

+48
-16
lines changed

2 files changed

+48
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{% load blog_tags %}
2+
<li class="comment even thread-even depth-{{ depth }} parent" id="comment-{{ comment_item.pk }}"
3+
style="margin-left: {% widthratio depth 1 3 %}rem">
4+
<div id="div-comment-{{ comment_item.pk }}" class="comment-body">
5+
<div class="comment-author vcard">
6+
<img alt=""
7+
src="{{ comment_item.author.email|gravatar_url:150 }}"
8+
srcset="{{ comment_item.author.email|gravatar_url:150 }}"
9+
class="avatar avatar-96 photo" height="96" width="96">
10+
<cite class="fn">
11+
<a rel="nofollow"
12+
{% if comment_item.author.is_superuser %}
13+
href="{{ comment_item.author.get_absolute_url }}"
14+
{% else %}
15+
href="#"
16+
{% endif %}
17+
rel="external nofollow"
18+
class="url">{{ comment_item.author.username }}
19+
</a>
20+
</cite>
21+
<span class="says">说道:</span>
22+
</div>
23+
24+
<div class="comment-meta commentmetadata">
25+
{{ comment_item.created_time }}
26+
</div>
27+
28+
<p>{{ comment_item.body |escape|custom_markdown }}</p>
29+
30+
<div class="reply"><a rel="nofollow" class="comment-reply-link"
31+
href="javascript:void(0)"
32+
onclick="do_reply({{ comment_item.pk }})"
33+
aria-label="回复给{{ comment_item.author.username }}">回复</a></div>
34+
</div>
35+
36+
</li><!-- #comment-## -->
37+
{% query article_comments parent_comment=comment_item as cc_comments %}
38+
{% for cc in cc_comments %}
39+
{% with comment_item=cc template_name="comments/tags/comment_item_tree.html" %}
40+
{% with depth=depth|add:1 %}
41+
{% include template_name %}
42+
{% endwith %}
43+
{% endwith %}
44+
{% endfor %}

templates/comments/tags/comment_list.html

+4-16
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,16 @@
1111
{% if article_comments %}
1212
{% cache 36000 article_comments article.id %}
1313
<div id="commentlist-container" class="comment-tab" style="display: block;">
14-
1514
<ol class="commentlist">
1615
{% query article_comments parent_comment=None as parent_comments %}
17-
{% for comment in parent_comments %}
18-
{% show_comment_item comment False %}
19-
20-
{% parse_commenttree article_comments comment as childcomments %}
21-
{% if childcomments %}
22-
<ul class="children">
23-
{% for child in childcomments %}
24-
{% show_comment_item child True %}
25-
26-
{% endfor %}
27-
</ul><!-- .children -->
28-
{% endif %}
29-
30-
16+
{% for comment_item in parent_comments %}
17+
{% with 0 as depth %}
18+
{% include "comments/tags/comment_item_tree.html" %}
19+
{% endwith %}
3120
{% endfor %}
3221

3322
</ol><!--/.commentlist-->
3423

35-
3624
</div>
3725
{% endcache %}
3826
{% endif %}

0 commit comments

Comments
 (0)