Spruced up UI a little bit.
[zzz-floof.git] / floof / templates / comments / lib.mako
1 <%def name="comment_block(comments)">
2 <h1>${len(comments)} comment${'' if len(comments) == 1 else 's'}</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 % if hasattr(comment, 'indent'):
17 <div class="comment" style="margin-left: ${comment.indent}em;">
18 % else:
19 <div class="comment">
20 % endif
21     <div class="header">
22         <div class="user">${comment.user.name}</div>
23         <div class="time">${comment.time}</div>
24         <div class="links">
25             <a href="${url(controller='comments', action='thread', id=comment.id, owner_url=h.get_comment_owner_url(**c.route))}">Link</a>
26             <a href="${url(controller='comments', action='reply', id=comment.id, owner_url=h.get_comment_owner_url(**c.route))}">Reply</a>
27             % if comment.parent:
28             <a href="${url(controller='comments', action='thread', id=comment.parent.id, owner_url=h.get_comment_owner_url(**c.route))}">Parent</a>
29             % endif
30         </div>
31     </div>
32     <p>${comment.text}</p>
33 </div>
34 </%def>