<%! from django.core.urlresolvers import reverse %> <%! from datehelper import time_ago_in_words %> <%! from dateutil.parser import parse %> <%def name="render_thread(thread, edit_thread=False, show_comments=False)"> <% if show_comments: url_for_thread = "" else: thread_id = thread['id'] url_for_thread = reverse('django_comment_client.forum.views.single_thread', args=[thread_id]) %>
${render_vote(thread)}
${thread['title']}
${thread['body']}
${render_info(thread)} % if edit_thread: ${render_reply()} ${render_edit()} ${render_watch_thread()} % endif
% if show_comments:
${render_comments(thread['children'])}
% endif
<%def name="render_comments(comments)"> % for comment in comments:
${render_vote(comment)}
${comment['body']}
${render_info(comment)} ${render_reply()} ${render_edit()}
${render_comments(comment['children'])}
% endfor <%def name="render_info(content)"> ${time_ago_in_words(parse(content['updated_at']))} ago by user No.${content['user_id']} <%def name="render_reply()"> Reply <%def name="render_edit()"> Edit <%def name="render_watch_thread()"> Watch <%def name="render_vote(content)"> <% upvote = "˄" downvote = "˅" %>
${upvote} ${downvote}