<%namespace name="renderer" file="_thread.html"/>

<section class="discussion inline-discussion" _id="${discussion_id}">
  <div class="discussion-non-content">
    <div class="discussion-title-wrapper">
      <a class="discussion-title" href="javascript:void(0)">Discussion</a>
    </div>
    <div class="search-wrapper-forum">
      <%include file="_search_bar.html" />
    </div>
    <div class="search-within">
      <input type="checkbox" id="discussion-search-within-board-${discussion_id}" class="discussion-search-within-board" checked/>
      <label for="discussion-search-within-board-${discussion_id}" class="discussion-search-within-board">Search within board</label>
    </div>
    <div class="discussion-new-post control-button" href="javascript:void(0)">New Post</div>
    <%include file="_sort.html" />
  </div>
  <div class="threads">
    % for thread in threads:
      ${renderer.render_thread(course_id, thread, show_comments=False)}
    % endfor
  </div>
  <%include file="_paginator.html" />
</section>

<%!
  def escape_quotes(text):
    return text.replace('\"', '\\\"').replace("\'", "\\\'")
%>

<script type="text/javascript">
  var $$user_info = JSON.parse('${user_info | escape_quotes}');
  var $$course_id = "${course_id}";
  if (typeof $$annotated_content_info === undefined || $$annotated_content_info === null) {
    var $$annotated_content_info = {};
  }
  $$annotated_content_info = $.extend($$annotated_content_info, JSON.parse("${annotated_content_info | escape_quotes}"));
</script>
