From fd7ac21608a94ee4da0acd11a51c36d55822f3d2 Mon Sep 17 00:00:00 2001 From: "Albert St. Aubin" Date: Tue, 30 May 2017 11:35:38 -0400 Subject: [PATCH] Working publisher/subscriber events for Cohorts and discussions --- cms/envs/common.py | 2 +- .../pages/lms/instructor_dashboard.py | 6 ++ .../discussion/test_discussion_management.py | 51 ++++++++++- lms/djangoapps/django_comment_client/utils.py | 15 +++- .../instructor/tests/test_ecommerce.py | 2 +- lms/djangoapps/instructor/tests/test_email.py | 6 +- .../instructor/tests/test_proctoring.py | 2 +- .../tests/views/test_instructor_dashboard.py | 4 +- .../instructor/views/instructor_dashboard.py | 8 +- lms/envs/common.py | 2 +- .../views/discussions.js | 85 ++++++++++++++----- lms/static/js/groups/views/cohorts.js | 28 +++--- .../js/spec/groups/views/cohorts_spec.js | 10 +-- lms/static/js/views/base_dashboard_view.js | 13 +++ .../instructor_dashboard_2/cohorts.underscore | 2 +- .../discussions.underscore | 2 +- .../discussions_management.html | 1 + .../instructor_dashboard_2.html | 6 +- 18 files changed, 187 insertions(+), 58 deletions(-) create mode 100644 lms/static/js/views/base_dashboard_view.js diff --git a/cms/envs/common.py b/cms/envs/common.py index aa5a50feb1..84d171c8d9 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -239,7 +239,7 @@ FEATURES = { 'ALLOW_PUBLIC_ACCOUNT_CREATION': True, # Whether or not the dynamic EnrollmentTrackUserPartition should be registered. - 'ENABLE_ENROLLMENT_TRACK_USER_PARTITION': False, + 'ENABLE_ENROLLMENT_TRACK_USER_PARTITION': True, } ENABLE_JASMINE = False diff --git a/common/test/acceptance/pages/lms/instructor_dashboard.py b/common/test/acceptance/pages/lms/instructor_dashboard.py index 1f727c321d..6b59e6ac00 100644 --- a/common/test/acceptance/pages/lms/instructor_dashboard.py +++ b/common/test/acceptance/pages/lms/instructor_dashboard.py @@ -56,6 +56,12 @@ class InstructorDashboardPage(CoursePage): discussion_management_section.wait_for_page() return discussion_management_section + def is_discussion_management_visible(self): + """ + Is the Discussion tab visible + """ + return self.q(css='[data-section="discussions_management"').visible + def select_data_download(self): """ Selects the data download tab and returns a DataDownloadPage. diff --git a/common/test/acceptance/tests/discussion/test_discussion_management.py b/common/test/acceptance/tests/discussion/test_discussion_management.py index ead561578a..4775556659 100644 --- a/common/test/acceptance/tests/discussion/test_discussion_management.py +++ b/common/test/acceptance/tests/discussion/test_discussion_management.py @@ -310,6 +310,7 @@ class DivisionSchemeTest(BaseDividedDiscussionTest, BaseDiscussionMixin): Go to the discussion tab on the instructor dashboard. """ self.instructor_dashboard_page.visit() + self.assertTrue(self.instructor_dashboard_page.is_discussion_management_visible()) self.instructor_dashboard_page.select_discussion_management() self.discussion_management_page.wait_for_page() @@ -357,11 +358,55 @@ class DivisionSchemeTest(BaseDividedDiscussionTest, BaseDiscussionMixin): def test_disabling_cohorts(self): """ - Test that disabling cohorts hides the cohort division scheme iff it is not the selected scheme + Test that the discussions management tab hides when there is <= 1 enrollment track, the Cohort division scheme + is not selected, and cohorts are disabled. (even without reloading the page). """ - # TODO: will be added as part of AJ's work. - pass + self.disable_cohorting(self.course_fixture) + self.instructor_dashboard_page.visit() + self.assertFalse(self.instructor_dashboard_page.is_discussion_management_visible()) + + def test_disabling_cohorts_while_selected(self): + """ + Test that disabling cohorts does not hide the discussion tab when there is more than one enrollment track. + Also that the division scheme for cohorts is visible iff it was selected. + (even without reloading the page). + """ + add_enrollment_course_modes(self.browser, self.course_id, ['audit', 'verified']) + + # Verify that the tab is visible, the cohort scheme is selected by default for divided discussions + self.disable_cohorting(self.course_fixture) + + # Go to Discussions tab and ensure that the correct scheme options are visible + self.view_discussion_management_page() + self.assertTrue( + self.discussion_management_page.division_scheme_visible( + self.discussion_management_page.COHORT_SCHEME + ) + ) + + def test_disabling_cohorts_while_not_selected(self): + """ + Test that disabling cohorts does not hide the discussion tab when there is more than one enrollment track. + Also that the division scheme for cohorts is not visible when cohorts are disabled and another scheme is + selected for division. + (even without reloading the page). + """ + add_enrollment_course_modes(self.browser, self.course_id, ['audit', 'verified']) + + # Verify that the tab is visible + self.view_discussion_management_page() + self.discussion_management_page.select_division_scheme(self.discussion_management_page.ENROLLMENT_TRACK_SCHEME) + self.verify_save_confirmation_message(self.scheme_key) + self.disable_cohorting(self.course_fixture) + + # Go to Discussions tab and ensure that the correct scheme options are visible + self.view_discussion_management_page() + self.assertFalse( + self.discussion_management_page.division_scheme_visible( + self.discussion_management_page.COHORT_SCHEME + ) + ) def test_single_enrollment_mode(self): """ diff --git a/lms/djangoapps/django_comment_client/utils.py b/lms/djangoapps/django_comment_client/utils.py index a2591fff0f..483fe2e917 100644 --- a/lms/djangoapps/django_comment_client/utils.py +++ b/lms/djangoapps/django_comment_client/utils.py @@ -868,11 +868,22 @@ def available_division_schemes(course_key): available_schemes = [] if is_course_cohorted(course_key): available_schemes.append(CourseDiscussionSettings.COHORT) - if len(_get_enrollment_track_groups(course_key)) > 1: + if enrollment_track_group_count(course_key) > 1: available_schemes.append(CourseDiscussionSettings.ENROLLMENT_TRACK) return available_schemes +def enrollment_track_group_count(course_key): + """ + Returns the count of possible enrollment track division schemes for this course. + Args: + course_key: CourseKey + Returns: + Count of enrollment track division scheme + """ + return len(_get_enrollment_track_groups(course_key)) + + def _get_course_division_scheme(course_discussion_settings): division_scheme = course_discussion_settings.division_scheme if ( @@ -882,7 +893,7 @@ def _get_course_division_scheme(course_discussion_settings): division_scheme = CourseDiscussionSettings.NONE elif ( division_scheme == CourseDiscussionSettings.ENROLLMENT_TRACK and - len(_get_enrollment_track_groups(course_discussion_settings.course_id)) <= 1 + enrollment_track_group_count(course_discussion_settings.course_id) <= 1 ): division_scheme = CourseDiscussionSettings.NONE return division_scheme diff --git a/lms/djangoapps/instructor/tests/test_ecommerce.py b/lms/djangoapps/instructor/tests/test_ecommerce.py index feacf20401..1d05e48071 100644 --- a/lms/djangoapps/instructor/tests/test_ecommerce.py +++ b/lms/djangoapps/instructor/tests/test_ecommerce.py @@ -30,7 +30,7 @@ class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase): # URL for instructor dash cls.url = reverse('instructor_dashboard', kwargs={'course_id': cls.course.id.to_deprecated_string()}) - cls.ecommerce_link = '' + cls.ecommerce_link = '' def setUp(self): super(TestECommerceDashboardViews, self).setUp() diff --git a/lms/djangoapps/instructor/tests/test_email.py b/lms/djangoapps/instructor/tests/test_email.py index da62d3176d..728142b055 100644 --- a/lms/djangoapps/instructor/tests/test_email.py +++ b/lms/djangoapps/instructor/tests/test_email.py @@ -31,7 +31,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(SharedModuleStoreTestCase): # URL for instructor dash cls.url = reverse('instructor_dashboard', kwargs={'course_id': cls.course.id.to_deprecated_string()}) # URL for email view - cls.email_link = '' + cls.email_link = '' def setUp(self): super(TestNewInstructorDashboardEmailViewMongoBacked, self).setUp() @@ -126,7 +126,7 @@ class TestNewInstructorDashboardEmailViewXMLBacked(SharedModuleStoreTestCase): # URL for instructor dash cls.url = reverse('instructor_dashboard', kwargs={'course_id': cls.course_key.to_deprecated_string()}) # URL for email view - cls.email_link = '' + cls.email_link = '' def setUp(self): super(TestNewInstructorDashboardEmailViewXMLBacked, self).setUp() @@ -138,7 +138,7 @@ class TestNewInstructorDashboardEmailViewXMLBacked(SharedModuleStoreTestCase): # URL for instructor dash self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course_key.to_deprecated_string()}) # URL for email view - self.email_link = '' + self.email_link = '' def tearDown(self): super(TestNewInstructorDashboardEmailViewXMLBacked, self).tearDown() diff --git a/lms/djangoapps/instructor/tests/test_proctoring.py b/lms/djangoapps/instructor/tests/test_proctoring.py index ff5f22b91e..841e87082d 100644 --- a/lms/djangoapps/instructor/tests/test_proctoring.py +++ b/lms/djangoapps/instructor/tests/test_proctoring.py @@ -27,7 +27,7 @@ class TestProctoringDashboardViews(SharedModuleStoreTestCase): # URL for instructor dash cls.url = reverse('instructor_dashboard', kwargs={'course_id': cls.course.id.to_deprecated_string()}) - button = '' + button = '' cls.proctoring_link = button def setUp(self): diff --git a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py index 80dd7844b6..e57109c2c1 100644 --- a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py +++ b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py @@ -228,7 +228,7 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT Test analytics dashboard message is shown """ response = self.client.get(self.url) - analytics_section = '' # pylint: disable=line-too-long + analytics_section = '' # pylint: disable=line-too-long self.assertIn(analytics_section, response.content) # link to dashboard shown @@ -327,7 +327,7 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT """ ora_section = ( '' diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 3250e335e6..9688458b5c 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -31,8 +31,8 @@ from xblock.field_data import DictFieldData from xblock.fields import ScopeIds from courseware.access import has_access from courseware.courses import get_course_by_id, get_studio_url -from django_comment_client.utils import has_forum_access -from django_comment_common.models import FORUM_ROLE_ADMINISTRATOR +from django_comment_client.utils import has_forum_access, available_division_schemes, enrollment_track_group_count +from django_comment_common.models import FORUM_ROLE_ADMINISTRATOR, CourseDiscussionSettings from openedx.core.djangoapps.course_groups.cohorts import get_course_cohorts, is_course_cohorted, DEFAULT_COHORT_NAME from student.models import CourseEnrollment from shoppingcart.models import Coupon, PaidCourseRegistration, CourseRegCodeItem @@ -524,9 +524,13 @@ def _section_cohort_management(course, access): def _section_discussions_management(course, access): """ Provide data for the corresponding discussion management section """ course_key = course.id + enrollment_track_schemes = available_division_schemes(course_key) section_data = { 'section_key': 'discussions_management', 'section_display_name': _('Discussions'), + 'is_hidden': (not is_course_cohorted(course_key) and + CourseDiscussionSettings.ENROLLMENT_TRACK not in enrollment_track_schemes), + 'enrollment_track_count': enrollment_track_group_count(course_key), 'discussion_topics_url': reverse('discussion_topics', kwargs={'course_key_string': unicode(course_key)}), 'course_discussion_settings': reverse( 'course_discussions_settings', diff --git a/lms/envs/common.py b/lms/envs/common.py index 13b86f4a20..9bb6e9efbf 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -379,7 +379,7 @@ FEATURES = { 'ENABLE_COOKIE_CONSENT': False, # Whether or not the dynamic EnrollmentTrackUserPartition should be registered. - 'ENABLE_ENROLLMENT_TRACK_USER_PARTITION': False, + 'ENABLE_ENROLLMENT_TRACK_USER_PARTITION': True, # Enable one click program purchase # See LEARNER-493 diff --git a/lms/static/js/discussions_management/views/discussions.js b/lms/static/js/discussions_management/views/discussions.js index 9576d3ebd6..956e68c01b 100644 --- a/lms/static/js/discussions_management/views/discussions.js +++ b/lms/static/js/discussions_management/views/discussions.js @@ -5,27 +5,34 @@ 'js/discussions_management/views/divided_discussions_course_wide', 'edx-ui-toolkit/js/utils/html-utils', 'edx-ui-toolkit/js/utils/string-utils', + 'js/views/base_dashboard_view', 'js/models/notification', 'js/views/notification' ], - function($, _, Backbone, gettext, InlineDiscussionsView, CourseWideDiscussionsView, HtmlUtils, StringUtils) { + function($, _, Backbone, gettext, InlineDiscussionsView, + CourseWideDiscussionsView, + HtmlUtils, StringUtils, BaseDashboardView) { /* global NotificationModel, NotificationView */ - var hiddenClass = 'is-hidden'; - var cohort = 'cohort'; - var none = 'none'; - var enrollmentTrack = 'enrollment_track'; + var HIDDEN_CLASS = 'hidden'; + var TWO_COLUMN_CLASS = 'two-column-layout'; + var THREE_COLUMN_CLASS = 'three-column-layout'; + var COHORT = 'cohort'; + var NONE = 'none'; + var ENROLLMENT_TRACK = 'enrollment_track'; - var DiscussionsView = Backbone.View.extend({ + var DiscussionsView = BaseDashboardView.extend({ events: { - 'click .division-scheme': 'divisionSchemeChanged' + 'click .division-scheme': 'divisionSchemeChanged', + 'change .cohorts-state': 'onCohortsEnabledChanged' }, initialize: function(options) { this.template = HtmlUtils.template($('#discussions-tpl').text()); this.context = options.context; this.discussionSettings = options.discussionSettings; + this.listenTo(this.pubSub, 'cohorts:state', this.cohortStateUpdate, this); }, render: function() { @@ -42,25 +49,25 @@ getDivisionSchemeData: function(selectedScheme) { return [ { - key: none, + key: NONE, displayName: gettext('Not divided'), descriptiveText: gettext('Discussions are unified; all learners interact with posts from other learners, regardless of the group they are in.'), // eslint-disable-line max-len - selected: selectedScheme === none, + selected: selectedScheme === NONE, enabled: true // always leave none enabled }, { - key: enrollmentTrack, + key: ENROLLMENT_TRACK, displayName: gettext('Enrollment Tracks'), descriptiveText: gettext('Use enrollment tracks as the basis for dividing discussions. All learners, regardless of their enrollment track, see the same discussion topics, but within divided topics, only learners who are in the same enrollment track see and respond to each others’ posts.'), // eslint-disable-line max-len - selected: selectedScheme === enrollmentTrack, - enabled: this.isSchemeAvailable(enrollmentTrack) || selectedScheme === enrollmentTrack + selected: selectedScheme === ENROLLMENT_TRACK, + enabled: this.isSchemeAvailable(ENROLLMENT_TRACK) || selectedScheme === ENROLLMENT_TRACK }, { - key: cohort, + key: COHORT, displayName: gettext('Cohorts'), descriptiveText: gettext('Use cohorts as the basis for dividing discussions. All learners, regardless of cohort, see the same discussion topics, but within divided topics, only members of the same cohort see and respond to each others’ posts. '), // eslint-disable-line max-len - selected: selectedScheme === cohort, - enabled: this.isSchemeAvailable(cohort) || selectedScheme === cohort + selected: selectedScheme === COHORT, + enabled: this.isSchemeAvailable(COHORT) || selectedScheme === COHORT } ]; @@ -80,6 +87,42 @@ this.notification.render(); }, + cohortStateUpdate: function(state) { + if ($('.discussions-management').data('enrollment-track-count') <= 1) { + this.showDiscussionManagement(state.is_cohorted); + } if (this.getSelectedScheme() !== COHORT) { + this.showCohortSchemeControl(state.is_cohorted); + } + }, + + showDiscussionManagement: function(show) { + if (!show) { + $('.btn-link.discussions_management').addClass(HIDDEN_CLASS); + $('#discussions_management').addClass(HIDDEN_CLASS); + } else { + $('.btn-link.discussions_management').removeClass(HIDDEN_CLASS); + $('#discussions_management').removeClass(HIDDEN_CLASS); + } + }, + + showCohortSchemeControl: function(show) { + if (!show) { + $('.division-scheme-item.cohort').addClass(HIDDEN_CLASS); + this.updateSchemeSelectionLayout(2); + } else { + $('.division-scheme-item.cohort').removeClass(HIDDEN_CLASS); + this.updateSchemeSelectionLayout(3); + } + }, + + updateSchemeSelectionLayout: function(columns) { + if (columns === 2) { + $('.division-scheme-item').removeClass(THREE_COLUMN_CLASS).addClass(TWO_COLUMN_CLASS); + } else { + $('.division-scheme-item').removeClass(TWO_COLUMN_CLASS).addClass(THREE_COLUMN_CLASS); + } + }, + removeNotification: function() { if (this.notification) { this.notification.remove(); @@ -120,13 +163,13 @@ fieldData, {patch: true, wait: true} ).done(function() { switch (selectedScheme) { - case none: + case NONE: details = gettext('Discussion topics in the course are not divided.'); break; - case enrollmentTrack: + case ENROLLMENT_TRACK: details = gettext('Any divided discussion topics are divided based on enrollment track.'); // eslint-disable-line max-len break; - case cohort: + case COHORT: details = gettext('Any divided discussion topics are divided based on cohort.'); break; default: @@ -156,10 +199,10 @@ }, updateTopicVisibility: function(selectedScheme, topicNav) { - if (selectedScheme === none) { - topicNav.addClass(hiddenClass); + if (selectedScheme === NONE) { + topicNav.addClass(HIDDEN_CLASS); } else { - topicNav.removeClass(hiddenClass); + topicNav.removeClass(HIDDEN_CLASS); } }, diff --git a/lms/static/js/groups/views/cohorts.js b/lms/static/js/groups/views/cohorts.js index 44d2c0cdda..bdab4c5e5f 100644 --- a/lms/static/js/groups/views/cohorts.js +++ b/lms/static/js/groups/views/cohorts.js @@ -1,20 +1,24 @@ (function(define) { 'use strict'; define(['jquery', 'underscore', 'backbone', 'gettext', 'js/groups/models/cohort', - 'js/groups/models/verified_track_settings', - 'js/groups/views/cohort_editor', 'js/groups/views/cohort_form', - 'js/groups/views/course_cohort_settings_notification', - 'js/groups/views/verified_track_settings_notification', - 'edx-ui-toolkit/js/utils/html-utils', - 'js/views/file_uploader', 'js/models/notification', 'js/views/notification', 'string_utils'], - function($, _, Backbone, gettext, CohortModel, VerifiedTrackSettingsModel, CohortEditorView, CohortFormView, - CourseCohortSettingsNotificationView, VerifiedTrackSettingsNotificationView, HtmlUtils) { - var hiddenClass = 'is-hidden', + 'js/groups/models/verified_track_settings', + 'js/groups/views/cohort_editor', 'js/groups/views/cohort_form', + 'js/groups/views/course_cohort_settings_notification', + 'js/groups/views/verified_track_settings_notification', + 'edx-ui-toolkit/js/utils/html-utils', + 'js/views/base_dashboard_view', + 'js/views/file_uploader', 'js/models/notification', 'js/views/notification', + 'string_utils'], + function($, _, Backbone, gettext, CohortModel, + VerifiedTrackSettingsModel, + CohortEditorView, CohortFormView, + CourseCohortSettingsNotificationView, + VerifiedTrackSettingsNotificationView, HtmlUtils, BaseDashboardView) { + var hiddenClass = 'hidden', disabledClass = 'is-disabled', enableCohortsSelector = '.cohorts-state'; - - var CohortsView = Backbone.View.extend({ + var CohortsView = BaseDashboardView.extend({ events: { 'change .cohort-select': 'onCohortSelected', 'change .cohorts-state': 'onCohortsEnabledChanged', @@ -27,7 +31,6 @@ initialize: function(options) { var model = this.model; - this.template = HtmlUtils.template($('#cohorts-tpl').text()); this.selectorTemplate = HtmlUtils.template($('#cohort-selector-tpl').text()); this.context = options.context; @@ -151,6 +154,7 @@ ).done(function() { self.render(); self.renderCourseCohortSettingsNotificationView(); + self.pubSub.trigger('cohorts:state', fieldData); }).fail(function(result) { self.showNotification({ type: 'error', diff --git a/lms/static/js/spec/groups/views/cohorts_spec.js b/lms/static/js/spec/groups/views/cohorts_spec.js index 96ae5576de..5b8a8855a5 100644 --- a/lms/static/js/spec/groups/views/cohorts_spec.js +++ b/lms/static/js/spec/groups/views/cohorts_spec.js @@ -276,7 +276,7 @@ define(['backbone', 'jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers ); // If no cohorts have been created, can't upload a CSV file. - expect(cohortsView.$('.wrapper-cohort-supplemental')).toHaveClass('is-hidden'); + expect(cohortsView.$('.wrapper-cohort-supplemental')).toHaveClass('hidden'); }); it('syncs data when membership tab is clicked', function() { @@ -294,7 +294,7 @@ define(['backbone', 'jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers createCohortsView(this); // Should see the control to toggle CSV file upload. - expect(cohortsView.$('.wrapper-cohort-supplemental')).not.toHaveClass('is-hidden'); + expect(cohortsView.$('.wrapper-cohort-supplemental')).not.toHaveClass('hidden'); // But upload form should not be visible until toggle is clicked. expect(cohortsView.$(fileUploadFormCss).length).toBe(0); uploadCsvToggle = cohortsView.$('.toggle-cohort-management-secondary'); @@ -302,7 +302,7 @@ define(['backbone', 'jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers toContain('Assign students to cohorts by uploading a CSV file'); uploadCsvToggle.click(); // After toggle is clicked, it should be hidden. - expect(uploadCsvToggle).toHaveClass('is-hidden'); + expect(uploadCsvToggle).toHaveClass('hidden'); fileUploadForm = cohortsView.$(fileUploadFormCss); expect(fileUploadForm.length).toBe(1); @@ -517,7 +517,7 @@ define(['backbone', 'jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers cohortsView.$('.action-create').click(); expect(cohortsView.$('.cohort-management-settings-form').length).toBe(1); expect(cohortsView.$('.cohort-management-nav')).toHaveClass('is-disabled'); - expect(cohortsView.$('.cohort-management-group')).toHaveClass('is-hidden'); + expect(cohortsView.$('.cohort-management-group')).toHaveClass('hidden'); cohortsView.$('.cohort-name').val(defaultCohortName); cohortsView.$('.type-random').prop('checked', true).change(); selectContentGroup(contentGroupId, MOCK_COHORTED_USER_PARTITION_ID); @@ -544,7 +544,7 @@ define(['backbone', 'jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers ); verifyHeader(1, defaultCohortName, 0, MOCK_RANDOM_ASSIGNMENT); expect(cohortsView.$('.cohort-management-nav')).not.toHaveClass('is-disabled'); - expect(cohortsView.$('.cohort-management-group')).not.toHaveClass('is-hidden'); + expect(cohortsView.$('.cohort-management-group')).not.toHaveClass('hidden'); expect(getAddModal().find('.cohort-management-settings-form').length).toBe(0); }); diff --git a/lms/static/js/views/base_dashboard_view.js b/lms/static/js/views/base_dashboard_view.js new file mode 100644 index 0000000000..ac57a5ecff --- /dev/null +++ b/lms/static/js/views/base_dashboard_view.js @@ -0,0 +1,13 @@ +(function(define) { + 'use strict'; + define(['jquery', 'backbone'], + function($, Backbone) { + // This Base view is useful when eventing or other features are shared between two or more + // views. Included with this view in the pubSub object allowing for events to be triggered + // and shared with other views. + var BaseDashboardView = Backbone.View.extend({ + pubSub: $.extend({}, Backbone.Events) + }); + return BaseDashboardView; + }); +}).call(this, define || RequireJS.define); diff --git a/lms/templates/instructor/instructor_dashboard_2/cohorts.underscore b/lms/templates/instructor/instructor_dashboard_2/cohorts.underscore index 21e9087fd1..df8328cab0 100644 --- a/lms/templates/instructor/instructor_dashboard_2/cohorts.underscore +++ b/lms/templates/instructor/instructor_dashboard_2/cohorts.underscore @@ -35,7 +35,7 @@ - +

diff --git a/lms/templates/instructor/instructor_dashboard_2/discussions.underscore b/lms/templates/instructor/instructor_dashboard_2/discussions.underscore index 2e0ceb83b3..d0d4a38cee 100644 --- a/lms/templates/instructor/instructor_dashboard_2/discussions.underscore +++ b/lms/templates/instructor/instructor_dashboard_2/discussions.underscore @@ -4,7 +4,7 @@

<% for (var i = 0; i < availableSchemes.length; i++) { %> -
+
diff --git a/lms/templates/instructor/instructor_dashboard_2/instructor_dashboard_2.html b/lms/templates/instructor/instructor_dashboard_2/instructor_dashboard_2.html index cf592aab79..d2629e252e 100644 --- a/lms/templates/instructor/instructor_dashboard_2/instructor_dashboard_2.html +++ b/lms/templates/instructor/instructor_dashboard_2/instructor_dashboard_2.html @@ -121,9 +121,10 @@ from openedx.core.djangolib.markup import HTML ## when the javascript loads, it clicks on the first section
    % for section_data in sections: + <% is_hidden = section_data.get('is_hidden', False) %> ## This is necessary so we don't scrape 'section_display_name' as a string. <% dname = section_data['section_display_name'] %> - + % endfor
@@ -131,7 +132,8 @@ from openedx.core.djangolib.markup import HTML ## to keep this short, sections can be pulled out into their own files % for section_data in sections: -
+ <% is_hidden = section_data.get('is_hidden', False) %> +