<%namespace name="renderer" file="_content_renderer.html"/>
<%! from django_comment_client.mustache_helpers import url_for_user %>

<article class="discussion-article" data-id="${discussion_id| h}">
  <a href="#" class="dogear"></a>
  <div class="discussion-post">
  
    <header>
    %if thread['group_id']:
      <div class="group-visibility-label">This post visible only to group ${cohort_dictionary[thread['group_id']]}. </div>
    %endif
      
        <a href="#" class="vote-btn discussion-vote discussion-vote-up"><span class="plus-icon">+</span> <span class='votes-count-number'>${thread['votes']['up_count']}</span></a>
      <h1>${thread['title']}</h1>
      <p class="posted-details">
        <span class="timeago" title="${thread['created_at'] | h}">sometime</span> by
        <a href="${url_for_user(thread, thread['user_id'])}">${thread['username']}</a>
      </p>
    </header>
    <div class="post-body">
      ${thread['body']}
    </div>
  </div>
  <ol class="responses">
    % for reply in thread.get("children", []):
    <li>
      <div class="response-body">${reply['body']}</div>
      <ol class="comments">
        % for comment in reply.get("children", []):
        <li><div class="comment-body">${comment['body']}</div></li>
        % endfor
      </ol>
    </li>
    % endfor
  </ol>
</article>

<%include file="_js_data.html" />
