<%page expression_filter="h"/>

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

<%!
from django.utils.translation import ugettext as _
from json import dumps as json_dumps
from openedx.core.djangolib.js_utils import js_escaped_string
%>

<div class="discussion-module" data-discussion-id="${discussion_id}"
    data-user-create-comment="${json_dumps(can_create_comment)}"
    data-user-create-subcomment="${json_dumps(can_create_subcomment)}"
    data-read-only="${'false' if can_create_thread else 'true'}">
    <div class="discussion-module-header">
        <h3 class="discussion-module-title">${_(display_name)}</h3>
        <div class="inline-discussion-topic"><span class="inline-discussion-topic-title">${_("Topic:")}</span> ${discussion_category} / ${discussion_target}</div>
    </div>
    <button class="discussion-show btn btn-brand" data-discussion-id="${discussion_id}">
        <span class="button-text">${_("Show Discussion")}</span>
    </button>
</div>
<script type="text/javascript">
/* global DiscussionModuleView */
/* exported DiscussionInlineBlock, $$course_id */
var $$course_id = "${course_id | n, js_escaped_string}";

function DiscussionInlineBlock(runtime, element) {
    'use strict';
    var el = $(element).find('.discussion-module');
    new DiscussionModuleView({ el: el });
}
</script>
