<%! import django_comment_client.helpers as helpers %>

<%def name="render_content(content)">
  ${helpers.render_content(content)}
</%def>

<%def name="render_content_with_comments(content)">
  <div class="${content['type']}" _id="${content['id']}" _discussion_id="${content.get('commentable_id')}" _author_id="${helpers.show_if(content['user_id'], content.get('anonymous'))}">
    ${render_content(content)}
    % if content.get('children') is not None:
      ${render_comments(content['children'])}
    % endif
  </div>
</%def>

<%def name="render_comments(comments)">
  <div class="comments">
    % for comment in comments:
      ${render_content_with_comments(comment)}
    % endfor
  </div>
</%def>
