From 15d77fda3fcaa4f92b6c3caf9353f040b612e649 Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Mon, 5 Oct 2015 11:51:02 -0400 Subject: [PATCH] Hide due/release dates on course outline in Studio. ECOM-2443 --- .../js/views/modals/course_outline_modals.js | 4 ++ cms/static/js/views/xblock_outline.js | 4 +- cms/templates/base.html | 3 +- cms/templates/js/course-outline.underscore | 26 +++++----- .../tests/studio/test_studio_outline.py | 50 +++++++++++++++++++ 5 files changed, 73 insertions(+), 14 deletions(-) diff --git a/cms/static/js/views/modals/course_outline_modals.js b/cms/static/js/views/modals/course_outline_modals.js index 5b00400447..416c9a5b8e 100644 --- a/cms/static/js/views/modals/course_outline_modals.js +++ b/cms/static/js/views/modals/course_outline_modals.js @@ -584,6 +584,10 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', editors.push(VerificationAccessEditor); } } + /* globals course */ + if (course.get('self_paced')) { + editors = _.without(editors, ReleaseDateEditor, DueDateEditor); + } return new SettingsXBlockModal($.extend({ editors: editors, model: xblockInfo diff --git a/cms/static/js/views/xblock_outline.js b/cms/static/js/views/xblock_outline.js index ad110ab1a5..2d4e04398d 100644 --- a/cms/static/js/views/xblock_outline.js +++ b/cms/static/js/views/xblock_outline.js @@ -89,6 +89,7 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "common/js/compo }, true); defaultNewChildName = childInfo.display_name; } + /* globals course */ return { xblockInfo: xblockInfo, visibilityClass: XBlockViewUtils.getXBlockVisibilityClass(xblockInfo.get('visibility_state')), @@ -104,7 +105,8 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "common/js/compo isCollapsed: isCollapsed, includesChildren: this.shouldRenderChildren(), hasExplicitStaffLock: this.model.get('has_explicit_staff_lock'), - staffOnlyMessage: this.model.get('staff_only_message') + staffOnlyMessage: this.model.get('staff_only_message'), + course: course }; }, diff --git a/cms/templates/base.html b/cms/templates/base.html index 2c4564abdf..8dd516495c 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -85,7 +85,8 @@ import json org: "${context_course.location.org | h}", num: "${context_course.location.course | h}", display_course_number: "${_(context_course.display_coursenumber)}", - revision: "${context_course.location.revision | h}" + revision: "${context_course.location.revision | h}", + self_paced: ${json.dumps(context_course.self_paced)} }); }); % endif diff --git a/cms/templates/js/course-outline.underscore b/cms/templates/js/course-outline.underscore index 94da74b5f0..749ce52798 100644 --- a/cms/templates/js/course-outline.underscore +++ b/cms/templates/js/course-outline.underscore @@ -113,18 +113,20 @@ if (xblockInfo.get('graded')) {

<%= gettext('Release Status:') %> - <% if (xblockInfo.get('released_to_students')) { %> - - <%= gettext('Released:') %> - <% } else if (xblockInfo.get('release_date')) { %> - - <%= gettext('Scheduled:') %> - <% } else { %> - - <%= gettext('Unscheduled') %> - <% } %> - <% if (xblockInfo.get('release_date')) { %> - <%= xblockInfo.get('release_date') %> + <% if (!course.get('self_paced')) { %> + <% if (xblockInfo.get('released_to_students')) { %> + + <%= gettext('Released:') %> + <% } else if (xblockInfo.get('release_date')) { %> + + <%= gettext('Scheduled:') %> + <% } else { %> + + <%= gettext('Unscheduled') %> + <% } %> + <% if (xblockInfo.get('release_date')) { %> + <%= xblockInfo.get('release_date') %> + <% } %> <% } %>

diff --git a/common/test/acceptance/tests/studio/test_studio_outline.py b/common/test/acceptance/tests/studio/test_studio_outline.py index 05f8693538..76c8e7b1af 100644 --- a/common/test/acceptance/tests/studio/test_studio_outline.py +++ b/common/test/acceptance/tests/studio/test_studio_outline.py @@ -1752,3 +1752,53 @@ class DeprecationWarningMessageTest(CourseOutlineTest): components_present=True, components_display_name_list=['Open', 'Peer'] ) + + +class SelfPacedOutlineTest(CourseOutlineTest): + """Test the course outline for a self-paced course.""" + + def populate_course_fixture(self, course_fixture): + course_fixture.add_children( + XBlockFixtureDesc('chapter', SECTION_NAME).add_children( + XBlockFixtureDesc('sequential', SUBSECTION_NAME).add_children( + XBlockFixtureDesc('vertical', UNIT_NAME) + ) + ), + ) + self.course_fixture.add_course_details({'self_paced': True}) + + def test_release_dates_not_shown(self): + """ + Scenario: Ensure that block release dates are not shown on the + course outline page of a self-paced course. + + Given I am the author of a self-paced course + When I go to the course outline + Then I should not see release dates for course content + """ + self.course_outline_page.visit() + section = self.course_outline_page.section(SECTION_NAME) + self.assertEqual(section.release_date, '') + subsection = section.subsection(SUBSECTION_NAME) + self.assertEqual(subsection.release_date, '') + + def test_edit_section_and_subsection(self): + """ + Scenario: Ensure that block release/due dates are not shown + in their settings modals. + + Given I am the author of a self-paced course + When I go to the course outline + And I click on settings for a section or subsection + Then I should not see release or due date settings + """ + self.course_outline_page.visit() + section = self.course_outline_page.section(SECTION_NAME) + modal = section.edit() + self.assertFalse(modal.has_release_date()) + self.assertFalse(modal.has_due_date()) + modal.cancel() + subsection = section.subsection(SUBSECTION_NAME) + modal = subsection.edit() + self.assertFalse(modal.has_release_date()) + self.assertFalse(modal.has_due_date())