Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@
renderCategoryMap: function(map) {
var categoryTemplate = edx.HtmlUtils.template($('#new-post-menu-category-template').html()),
entryTemplate = edx.HtmlUtils.template($('#new-post-menu-entry-template').html()),
mappedCategorySnippets = _.map(map.children, function(name) {
mappedCategorySnippets = _.map(map.children, function(child) {
var entry,
html = '';
if (_.has(map.entries, name)) {
html = '',
name = child[0], // child[0] is the category name
type = child[1]; // child[1] is the type (i.e. 'entry' or 'subcategory')
if (_.has(map.entries, name) && type === 'entry') {
entry = map.entries[name];
html = entryTemplate({
text: name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@
beforeEach(function() {
this.course_settings = new DiscussionCourseSettings({
'category_map': {
'children': ['Topic', 'General', 'Basic Question'],
'children': [ // eslint-disable-line quote-props
['Topic', 'entry'],
['General', 'entry'],
['Basic Question', 'entry']
],
'entries': {
'Topic': {
'is_cohorted': true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
'Basic Question Types': {
'subcategories': {},
'children': [
'Selection From Options',
'Numerical Input',
'Very long category name',
'Very very very very long category name',
'Name with <em>HTML</em>'
['Selection From Options', 'entry'],
['Numerical Input', 'entry'],
['Very long category name', 'entry'],
['Very very very very long category name', 'entry'],
['Name with <em>HTML</em>', 'entry']
],
'entries': {
'Selection From Options': {
Expand Down Expand Up @@ -59,7 +59,7 @@
'Example Inline Discussion': {
'subcategories': {},
'children': [
'What Are Your Goals for Creating a MOOC?'
['What Are Your Goals for Creating a MOOC?', 'entry']
],
'entries': {
'What Are Your Goals for Creating a MOOC?': {
Expand All @@ -70,7 +70,10 @@
}
}
},
'children': ['Basic Question Types', 'Example Inline Discussion'],
'children': [ // eslint-disable-line quote-props
['Basic Question Types', 'subcategory'],
['Example Inline Discussion', 'subcategory']
],
'entries': {}
},
'is_cohorted': true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
beforeEach(function() {
this.course_settings = new DiscussionCourseSettings({
category_map: {
children: ['Topic', 'General', 'Not Cohorted'],
children: [['Topic', 'entry'], ['General', 'entry'], ['Not Cohorted', 'entry']],
entries: {
Topic: {
is_cohorted: true,
Expand Down Expand Up @@ -172,7 +172,9 @@
'subcategories': {
'Week 1': {
'subcategories': {},
'children': ['Topic-Level Student-Visible Label'],
'children': [ // eslint-disable-line quote-props
['Topic-Level Student-Visible Label', 'entry']
],
'entries': {
'Topic-Level Student-Visible Label': {
'sort_key': null,
Expand All @@ -182,7 +184,10 @@
}
}
},
'children': ['General', 'Week 1'],
'children': [ // eslint-disable-line quote-props
['General', 'entry'],
['Week 1', 'subcategory']
],
'entries': {
'General': {
'sort_key': 'General',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
DiscussionSpecHelper.createTestCourseSettings = function() {
return new DiscussionCourseSettings({
category_map: {
children: ['Test Topic', 'Other Topic'],
children: [['Test Topic', 'entry'], ['Other Topic', 'entry']],
entries: {
'Test Topic': {
is_cohorted: true,
Expand Down
6 changes: 6 additions & 0 deletions lms/djangoapps/django_comment_client/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""
Constants for Discussions
"""

TYPE_ENTRY = 'entry' # A leaf node in a category hierarchy.
TYPE_SUBCATEGORY = 'subcategory' # A non-leaf node in a category hierarchy.
Loading