More thorough support for comment threading.
[zzz-floof.git] / floof / templates / comments / lib.mako
1 <%def name="comment_block(comments)">
2 <h1>${len(comments)} comments</h1>
3 <p><a href="${url(controller='comments', action='thread', owner_url=h.get_comment_owner_url(**c.route))}">View all</a></p>
4 <p><a href="${url(controller='comments', action='reply', owner_url=h.get_comment_owner_url(**c.route))}">Reply</a></p>
5 ${comment_thread(comments)}
6 </%def>
7
8 <%def name="comment_thread(comments)">
9 <%! from floof.model.comments import indent_comments %>\
10 % for comment in indent_comments(comments):
11 ${single_comment(comment)}
12 % endfor
13 </%def>
14
15 <%def name="single_comment(comment)">
16 <div class="comment" style="margin-left: ${comment.indent}em;">
17     <div class="header">
18         <div class="user">${comment.user.name}</div>
19         <div class="time">${comment.time}</div>
20         <div class="link"><a href="${url(controller='comments', action='thread', id=comment.id, owner_url=h.get_comment_owner_url(**c.route))}">Link</a></div>
21     </div>
22     <p>${comment.text}</p>
23 </div>
24 </%def>