TNL-5621 Fix discussion topics in MIT course.

This commit is contained in:
attiyaishaque
2016-10-06 12:09:59 +05:00
parent c873be0f55
commit 76e1d4a75c
14 changed files with 146 additions and 107 deletions

View File

@@ -33,8 +33,11 @@
entries = courseWideDiscussions.entries,
children = courseWideDiscussions.children;
return HtmlUtils.joinHtml.apply(this, _.map(children, function(name) {
var entry = entries[name];
return HtmlUtils.joinHtml.apply(this, _.map(children, function(child) {
// child[0] is the category name, child[1] is the type.
// For course wide discussions, the type is always 'entry'
var name = child[0],
entry = entries[name];
return subCategoryTemplate({
name: name,
id: entry.id,

View File

@@ -48,9 +48,12 @@
entries = inlineDiscussions.entries,
subcategories = inlineDiscussions.subcategories;
return HtmlUtils.joinHtml.apply(this, _.map(children, function(name) {
var htmlSnippet = '', entry;
if (entries && _.has(entries, name)) {
return HtmlUtils.joinHtml.apply(this, _.map(children, function(child) {
var htmlSnippet = '',
name = child[0], // child[0] is the category name
type = child[1], // child[1] is the type (i.e. 'entry' or 'subcategory')
entry;
if (entries && _.has(entries, name) && type === 'entry') {
entry = entries[name];
htmlSnippet = entryTemplate({
name: name,