diff --git a/common/static/common/js/discussion/discussion.js b/common/static/common/js/discussion/discussion.js index 4ef2949f89..bdd9f25956 100644 --- a/common/static/common/js/discussion/discussion.js +++ b/common/static/common/js/discussion/discussion.js @@ -36,7 +36,7 @@ this.pages = options.pages || 1; this.current_page = 1; this.sort_preference = options.sort; - this.is_commentable_cohorted = options.is_commentable_cohorted; + this.is_commentable_divided = options.is_commentable_divided; this.bind('add', function(item) { item.discussion = self; }); @@ -142,7 +142,7 @@ Content.loadContentInfos(response.annotated_content_info); self.pages = response.num_pages; self.current_page = response.page; - self.is_commentable_cohorted = response.is_commentable_cohorted; + self.is_commentable_divided = response.is_commentable_divided; return self.reset(new_collection); }, error: error diff --git a/common/static/common/js/discussion/views/discussion_inline_view.js b/common/static/common/js/discussion/views/discussion_inline_view.js index 6b36fbe2b3..fe9fdc3529 100644 --- a/common/static/common/js/discussion/views/discussion_inline_view.js +++ b/common/static/common/js/discussion/views/discussion_inline_view.js @@ -86,7 +86,7 @@ DiscussionUtil.loadRoles(response.roles); this.courseSettings = new DiscussionCourseSettings(response.course_settings); - this.is_commentable_cohorted = response.is_commentable_cohorted; + this.is_commentable_divided = response.is_commentable_divided; this.discussion = new Discussion(undefined, {pages: response.num_pages}); this.discussion.reset(response.discussion_data, { @@ -126,7 +126,7 @@ course_settings: this.courseSettings, topicId: discussionId, startHeader: this.startHeader, - is_commentable_cohorted: response.is_commentable_cohorted + is_commentable_divided: response.is_commentable_divided }); this.newPostView.render(); @@ -154,7 +154,7 @@ mode: 'inline', startHeader: this.startHeader, courseSettings: this.courseSettings, - is_commentable_cohorted: this.is_commentable_cohorted + is_commentable_divided: this.is_commentable_divided }); this.threadView.render(); this.listenTo(this.threadView.showView, 'thread:_delete', this.navigateToAllPosts); diff --git a/common/static/common/js/discussion/views/discussion_thread_show_view.js b/common/static/common/js/discussion/views/discussion_thread_show_view.js index 1f453ca577..787a5dba2b 100644 --- a/common/static/common/js/discussion/views/discussion_thread_show_view.js +++ b/common/static/common/js/discussion/views/discussion_thread_show_view.js @@ -31,7 +31,7 @@ DiscussionThreadShowView.__super__.initialize.call(this); this.mode = options.mode || 'inline'; this.startHeader = options.startHeader; - this.is_commentable_cohorted = options.is_commentable_cohorted; + this.is_commentable_divided = options.is_commentable_divided; if ((_ref = this.mode) !== 'tab' && _ref !== 'inline') { throw new Error('invalid mode: ' + this.mode); } @@ -42,7 +42,7 @@ mode: this.mode, startHeader: this.startHeader, flagged: this.model.isFlagged(), - is_commentable_cohorted: this.is_commentable_cohorted, + is_commentable_divided: this.is_commentable_divided, author_display: this.getAuthorDisplay(), cid: this.model.cid, readOnly: $('.discussion-module').data('read-only') diff --git a/common/static/common/js/discussion/views/discussion_thread_view.js b/common/static/common/js/discussion/views/discussion_thread_view.js index 8936643e6f..11405cd0ff 100644 --- a/common/static/common/js/discussion/views/discussion_thread_view.js +++ b/common/static/common/js/discussion/views/discussion_thread_view.js @@ -92,7 +92,7 @@ self.model = collection.get(id); } }); - this.is_commentable_cohorted = options.is_commentable_cohorted; + this.is_commentable_divided = options.is_commentable_divided; this.createShowView(); this.responses = new Comments(); this.loadedResponses = false; @@ -423,7 +423,7 @@ model: this.model, mode: this.mode, startHeader: this.startHeader, - is_commentable_cohorted: this.is_commentable_cohorted + is_commentable_divided: this.is_commentable_divided }); this.showView.bind('thread:_delete', this._delete); return this.showView.bind('thread:edit', this.edit); diff --git a/common/static/common/js/discussion/views/discussion_topic_menu_view.js b/common/static/common/js/discussion/views/discussion_topic_menu_view.js index a98b5b91c7..9e6797d322 100644 --- a/common/static/common/js/discussion/views/discussion_topic_menu_view.js +++ b/common/static/common/js/discussion/views/discussion_topic_menu_view.js @@ -55,7 +55,7 @@ html = entryTemplate({ text: name, id: entry.id, - is_cohorted: entry.is_cohorted + is_divided: entry.is_divided }); } else { // subcategory html = categoryTemplate({ diff --git a/common/static/common/js/discussion/views/new_post_view.js b/common/static/common/js/discussion/views/new_post_view.js index c60146b7f3..cfb851808a 100644 --- a/common/static/common/js/discussion/views/new_post_view.js +++ b/common/static/common/js/discussion/views/new_post_view.js @@ -41,7 +41,7 @@ throw new Error('invalid mode: ' + this.mode); } this.course_settings = options.course_settings; - this.is_commentable_cohorted = options.is_commentable_cohorted; + this.is_commentable_divided = options.is_commentable_divided; this.topicId = options.topicId; this.discussionBoardView = options.discussionBoardView; }; @@ -52,7 +52,7 @@ context = _.clone(this.course_settings.attributes); _.extend(context, { cohort_options: this.getCohortOptions(), - is_commentable_cohorted: this.is_commentable_cohorted, + is_commentable_divided: this.is_commentable_divided, mode: this.mode, startHeader: this.startHeader, form_id: this.mode + (this.topicId ? '-' + this.topicId : '') @@ -85,14 +85,14 @@ }; NewPostView.prototype.getCohortOptions = function() { - var userCohortId; + var userGroupId; if (this.course_settings.get('is_cohorted') && DiscussionUtil.isPrivilegedUser()) { - userCohortId = $('#discussion-container').data('user-cohort-id'); + userGroupId = $('#discussion-container').data('user-group-id'); return _.map(this.course_settings.get('cohorts'), function(cohort) { return { value: cohort.id, text: cohort.name, - selected: cohort.id === userCohortId + selected: cohort.id === userGroupId }; }); } else { diff --git a/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js b/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js index 6b3c3d2921..ef1f711067 100644 --- a/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js +++ b/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js @@ -96,29 +96,29 @@ describe('renderComments', function() { beforeEach(function() { this.course_settings = new DiscussionCourseSettings({ - 'category_map': { - 'children': [ // eslint-disable-line quote-props + category_map: { + children: [ ['Topic', 'entry'], ['General', 'entry'], ['Basic Question', 'entry'] ], - 'entries': { - 'Topic': { - 'is_cohorted': true, - 'id': 'topic' + entries: { + Topic: { + is_divided: true, + id: 'topic' }, - 'General': { - 'sort_key': 'General', - 'is_cohorted': false, - 'id': '6.00.1x_General' + General: { + sort_key: 'General', + is_divided: false, + id: '6.00.1x_General' }, 'Basic Question': { - 'is_cohorted': false, - 'id': "6>00'1x\"Basic_Question" + is_divided: false, + id: "6>00'1x\"Basic_Question" } } }, - 'is_cohorted': true + is_cohorted: true }); }); diff --git a/common/static/common/js/spec/discussion/view/discussion_thread_show_view_spec.js b/common/static/common/js/spec/discussion/view/discussion_thread_show_view_spec.js index 9ba9dd5d5f..ce603770a6 100644 --- a/common/static/common/js/spec/discussion/view/discussion_thread_show_view_spec.js +++ b/common/static/common/js/spec/discussion/view/discussion_thread_show_view_spec.js @@ -173,23 +173,23 @@ }); }); describe('cohorting', function() { - it('renders correctly for an uncohorted thread', function() { + it('renders correctly for a unified thread', function() { this.view.render(); return expect(this.view.$('.group-visibility-label').text().trim()) .toEqual('This post is visible to everyone.'); }); - it('renders correctly for a cohorted thread', function() { + it('renders correctly for a divided thread', function() { this.thread.set('group_id', '1'); this.thread.set('group_name', 'Mock Cohort'); - this.view.is_commentable_cohorted = true; + this.view.is_commentable_divided = true; this.view.render(); return expect(this.view.$('.group-visibility-label').text().trim()) .toEqual('This post is visible only to Mock Cohort.'); }); - it('renders correctly for a grouped uncohorted thread', function() { + it('renders correctly for a grouped unified thread', function() { this.thread.set('group_id', '1'); this.thread.set('group_name', 'Mock Cohort'); - this.view.is_commentable_cohorted = false; + this.view.is_commentable_divided = false; this.view.render(); return expect(this.view.$('.group-visibility-label').text().trim()) .toEqual('This post is visible to everyone.'); diff --git a/common/static/common/js/spec/discussion/view/discussion_topic_menu_view_spec.js b/common/static/common/js/spec/discussion/view/discussion_topic_menu_view_spec.js index 4c9a3e798a..eaaec587e8 100644 --- a/common/static/common/js/spec/discussion/view/discussion_topic_menu_view_spec.js +++ b/common/static/common/js/spec/discussion/view/discussion_topic_menu_view_spec.js @@ -16,67 +16,67 @@ DiscussionSpecHelper.setUpGlobals(); DiscussionSpecHelper.setUnderscoreFixtures(); this.course_settings = new DiscussionCourseSettings({ - 'category_map': { - 'subcategories': { + category_map: { + subcategories: { 'Basic Question Types': { - 'subcategories': {}, - 'children': [ + subcategories: {}, + children: [ ['Selection From Options', 'entry'], ['Numerical Input', 'entry'], ['Very long category name', 'entry'], ['Very very very very long category name', 'entry'], ['Name with HTML', 'entry'] ], - 'entries': { + entries: { 'Selection From Options': { - 'sort_key': null, - 'is_cohorted': true, - 'id': 'cba3e4cd91d0466b9ac50926e495b76f' + sort_key: null, + is_divided: true, + id: 'cba3e4cd91d0466b9ac50926e495b76f' }, 'Numerical Input': { - 'sort_key': null, - 'is_cohorted': false, - 'id': 'c49f0dfb8fc94c9c8d9999cc95190c56' + sort_key: null, + is_divided: false, + id: 'c49f0dfb8fc94c9c8d9999cc95190c56' }, 'Very long category name': { - 'sort_key': null, - 'is_cohorted': false, - 'id': 'c49f0dfb8fc94c9c8d9999cc95190c59' + sort_key: null, + is_divided: false, + id: 'c49f0dfb8fc94c9c8d9999cc95190c59' }, 'Very very very very long category name': { - 'sort_key': null, - 'is_cohorted': false, - 'id': 'c49f0dfb8fc94c9c8d9999cc95190e32' + sort_key: null, + is_divided: false, + id: 'c49f0dfb8fc94c9c8d9999cc95190e32' }, 'Name with HTML': { - 'sort_key': null, - 'is_cohorted': false, - 'id': 'c49f0dfb8fc94c9c8d9999cc95190363' + sort_key: null, + is_divided: false, + id: 'c49f0dfb8fc94c9c8d9999cc95190363' } } }, 'Example Inline Discussion': { - 'subcategories': {}, - 'children': [ + subcategories: {}, + children: [ ['What Are Your Goals for Creating a MOOC?', 'entry'] ], - 'entries': { + entries: { 'What Are Your Goals for Creating a MOOC?': { - 'sort_key': null, - 'is_cohorted': true, - 'id': 'cba3e4cd91d0466b9ac50926e495b931' + sort_key: null, + is_divided: true, + id: 'cba3e4cd91d0466b9ac50926e495b931' } } } }, - 'children': [ // eslint-disable-line quote-props + children: [ ['Basic Question Types', 'subcategory'], ['Example Inline Discussion', 'subcategory'] ], - 'entries': {} + entries: {} }, - 'is_cohorted': true + is_cohorted: true }); }); diff --git a/common/static/common/js/spec/discussion/view/new_post_view_spec.js b/common/static/common/js/spec/discussion/view/new_post_view_spec.js index ea5653cf18..1d109de321 100644 --- a/common/static/common/js/spec/discussion/view/new_post_view_spec.js +++ b/common/static/common/js/spec/discussion/view/new_post_view_spec.js @@ -38,15 +38,15 @@ children: [['Topic', 'entry'], ['General', 'entry'], ['Not Cohorted', 'entry']], entries: { Topic: { - is_cohorted: true, + is_divided: true, id: 'topic' }, General: { - is_cohorted: true, + is_divided: true, id: 'general' }, 'Not Cohorted': { - is_cohorted: false, + is_divided: false, id: 'not-cohorted' } } @@ -145,20 +145,20 @@ }); it('disables the cohort menu if it is set false', function() { DiscussionSpecHelper.makeModerator(); - this.view.is_commentable_cohorted = false; + this.view.is_commentable_divided = false; return checkVisibility(this.view, true, true, true); }); it('enables the cohort menu if it is set true', function() { DiscussionSpecHelper.makeModerator(); - this.view.is_commentable_cohorted = true; + this.view.is_commentable_divided = true; return checkVisibility(this.view, true, false, true); }); it('is not visible to students when set false', function() { - this.view.is_commentable_cohorted = false; + this.view.is_commentable_divided = false; return checkVisibility(this.view, false, false, true); }); it('is not visible to students when set true', function() { - this.view.is_commentable_cohorted = true; + this.view.is_commentable_divided = true; return checkVisibility(this.view, false, false, true); }); }); @@ -166,33 +166,33 @@ var checkPostCancelReset; beforeEach(function() { this.course_settings = new DiscussionCourseSettings({ - 'allow_anonymous_to_peers': true, - 'allow_anonymous': true, - 'category_map': { - 'subcategories': { + allow_anonymous_to_peers: true, + allow_anonymous: true, + category_map: { + subcategories: { 'Week 1': { - 'subcategories': {}, - 'children': [ // eslint-disable-line quote-props + subcategories: {}, + children: [ ['Topic-Level Student-Visible Label', 'entry'] ], - 'entries': { + entries: { 'Topic-Level Student-Visible Label': { - 'sort_key': null, - 'is_cohorted': false, - 'id': '2b3a858d0c884eb4b272dbbe3f2ffddd' + sort_key: null, + is_divided: false, + id: '2b3a858d0c884eb4b272dbbe3f2ffddd' } } } }, - 'children': [ // eslint-disable-line quote-props + children: [ ['General', 'entry'], ['Week 1', 'subcategory'] ], - 'entries': { - 'General': { - 'sort_key': 'General', - 'is_cohorted': false, - 'id': 'i4x-waqastest-waqastest-course-waqastest' + entries: { + General: { + sort_key: 'General', + is_divided: false, + id: 'i4x-waqastest-waqastest-course-waqastest' } } } @@ -255,7 +255,7 @@ entries: { 'Topic-Level Student-Visible Label': { sort_key: null, - is_cohorted: false, + is_divided: false, id: '2b3a858d0c884eb4b272dbbe3f2ffddd' } } @@ -268,7 +268,7 @@ entries: { 'First topic': { sort_key: 'First topic', - is_cohorted: false, + is_divided: false, id: 'i4x-waqastest-waqastest-course-waqastest' } } diff --git a/common/static/common/js/spec_helpers/discussion_spec_helper.js b/common/static/common/js/spec_helpers/discussion_spec_helper.js index 7a05b8d8ff..a5c7c48082 100644 --- a/common/static/common/js/spec_helpers/discussion_spec_helper.js +++ b/common/static/common/js/spec_helpers/discussion_spec_helper.js @@ -58,11 +58,11 @@ children: [['Test Topic', 'entry'], ['Other Topic', 'entry']], entries: { 'Test Topic': { - is_cohorted: true, + is_divided: true, id: 'test_topic' }, 'Other Topic': { - is_cohorted: true, + is_divided: true, id: 'other_topic' } } diff --git a/common/static/common/templates/discussion/new-post-menu-entry.underscore b/common/static/common/templates/discussion/new-post-menu-entry.underscore index d3f300f94c..854a95ab56 100644 --- a/common/static/common/templates/discussion/new-post-menu-entry.underscore +++ b/common/static/common/templates/discussion/new-post-menu-entry.underscore @@ -1 +1 @@ - + diff --git a/common/static/common/templates/discussion/new-post.underscore b/common/static/common/templates/discussion/new-post.underscore index 1376a2111c..aaa28611ed 100644 --- a/common/static/common/templates/discussion/new-post.underscore +++ b/common/static/common/templates/discussion/new-post.underscore @@ -10,7 +10,7 @@
<% if (cohort_options) { %> -