From d514f363fc9ba2e6024a4563f30d1cb32490e74f Mon Sep 17 00:00:00 2001 From: Ben McMorran Date: Wed, 30 Jul 2014 17:03:30 -0400 Subject: [PATCH] Integrate UI text strings from doc STUD-1856 Display "IS VISIBLE TO" when released and published Reword staff lock prompt and notifications Change "View Published Version" to "View Live Version" Change "Unit Tree Location" to "Unit Location in Course" Switch live content warning based on unpublished changes Reword discard changes confirmation prompt Reword unit location tip Add "Edit the name" popup text for sections and subsections Fix popup text for section and subsection titles Add popup text for new section, subsection, and unit buttons Reword popup for View Live button and add tests Reword notification when removing staff lock Update MessageView when has_changes changed Change "Published" to "Published (not yet released)" Change "Unpublished (Staff only)" to "Visible to Staff Only" --- cms/static/js/base.js | 6 +-- .../views/pages/container_subviews_spec.js | 54 +++++++++++++++---- .../js/views/pages/container_subviews.js | 18 ++++--- cms/static/js/views/xblock_outline.js | 2 + cms/templates/container.html | 4 +- cms/templates/course_outline.html | 5 +- cms/templates/js/container-message.underscore | 6 ++- cms/templates/js/course-outline.underscore | 9 ++-- .../js/mock/mock-container-page.underscore | 6 +-- .../mock/mock-course-outline-page.underscore | 6 +-- cms/templates/js/publish-xblock.underscore | 12 +++-- cms/templates/js/xblock-outline.underscore | 9 ++-- .../js/xblock-string-field-editor.underscore | 8 ++- .../test/acceptance/pages/studio/container.py | 5 +- .../acceptance/tests/test_studio_container.py | 8 +-- 15 files changed, 107 insertions(+), 51 deletions(-) diff --git a/cms/static/js/base.js b/cms/static/js/base.js index 4b813caf8d..50fd5918c2 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -54,10 +54,8 @@ domReady(function() { }); // general link management - new window/tab - $('a[rel="external"]').attr({ - title: gettext('This link will open in a new browser window/tab'), - target: '_blank' - }); + $('a[rel="external"]:not([title])').attr('title', gettext('This link will open in a new browser window/tab')); + $('a[rel="external"]').attr('target', '_blank'); // general link management - lean modal window $('a[rel="modal"]').attr('title', gettext('This link will open in a modal window')).leanModal({ diff --git a/cms/static/js/spec/views/pages/container_subviews_spec.js b/cms/static/js/spec/views/pages/container_subviews_spec.js index a4c5ef1762..040e0089ea 100644 --- a/cms/static/js/spec/views/pages/container_subviews_spec.js +++ b/cms/static/js/spec/views/pages/container_subviews_spec.js @@ -182,7 +182,7 @@ define(["jquery", "underscore", "underscore.string", "js/spec_helpers/create_sin published: true, has_changes: false, visibility_state: VisibilityState.ready, release_date: "Jul 02, 2030 at 14:20 UTC" }); - expect(containerPage.$(headerCss).text()).toContain('Published'); + expect(containerPage.$(headerCss).text()).toContain('Published (not yet released)'); expect(containerPage.$(publishButtonCss)).toHaveClass(disabledCss); expect(containerPage.$(discardChangesButtonCss)).toHaveClass(disabledCss); expect(containerPage.$(bitPublishingCss)).toHaveClass(readyClass); @@ -210,7 +210,7 @@ define(["jquery", "underscore", "underscore.string", "js/spec_helpers/create_sin fetch({published: true, has_changes: false, visibility_state: VisibilityState.unscheduled, release_date: null }); - expect(containerPage.$(headerCss).text()).toContain('Published'); + expect(containerPage.$(headerCss).text()).toContain('Published (not yet released)'); expect(containerPage.$(publishButtonCss)).toHaveClass(disabledCss); expect(containerPage.$(discardChangesButtonCss)).toHaveClass(disabledCss); verifyPublishingBitUnscheduled(); @@ -381,7 +381,8 @@ define(["jquery", "underscore", "underscore.string", "js/spec_helpers/create_sin }); describe("Content Visibility", function () { - var requestStaffOnly, verifyStaffOnly, promptSpy; + var requestStaffOnly, verifyStaffOnly, promptSpy, + visibilityTitleCss = '.wrapper-visibility .title'; requestStaffOnly = function(isStaffOnly) { containerPage.$('.action-staff-lock').click(); @@ -428,6 +429,24 @@ define(["jquery", "underscore", "underscore.string", "js/spec_helpers/create_sin verifyStaffOnly(false); }); + it("displays 'Is Visible To' when released and published", function() { + renderContainerPage(this, mockContainerXBlockHtml, { + released_to_students: true, + published: true, + has_changes: false + }); + expect(containerPage.$(visibilityTitleCss).text()).toContain('Is Visible To'); + }); + + it("displays 'Will Be Visible To' when not released or fully published", function() { + renderContainerPage(this, mockContainerXBlockHtml, { + released_to_students: false, + published: true, + has_changes: true + }); + expect(containerPage.$(visibilityTitleCss).text()).toContain('Will Be Visible To') + }); + it("can be set to staff only", function() { renderContainerPage(this, mockContainerXBlockHtml); requestStaffOnly(true); @@ -500,25 +519,37 @@ define(["jquery", "underscore", "underscore.string", "js/spec_helpers/create_sin describe("Message Area", function() { var messageSelector = '.container-message .warning', - warningMessage = 'This content is live for students. Edit with caution.'; + unchangedWarningMessage = 'This unit is visible to students. If you edit the unit, you must re-publish it for students to see your changes.', + hasChangesWarningMessage = 'Caution: The last published version of this unit is live. By publishing changes you will change the student experience.'; it('is empty for a unit that is not currently visible to students', function() { renderContainerPage(this, mockContainerXBlockHtml, { - currently_visible_to_students: false + currently_visible_to_students: false, + has_changes: false }); expect(containerPage.$(messageSelector).text().trim()).toBe(''); }); - it('shows a message for a unit that is currently visible to students', function() { + it('shows a message for a unit that is currently visible to students and is unchanged', function() { renderContainerPage(this, mockContainerXBlockHtml, { - currently_visible_to_students: true + currently_visible_to_students: true, + has_changes: false }); - expect(containerPage.$(messageSelector).text().trim()).toBe(warningMessage); + expect(containerPage.$(messageSelector).text().trim()).toBe(unchangedWarningMessage); + }); + + it('shows a message for a unit that is currently visible to students and has changes', function() { + renderContainerPage(this, mockContainerXBlockHtml, { + currently_visible_to_students: true, + has_changes: true + }); + expect(containerPage.$(messageSelector).text().trim()).toBe(hasChangesWarningMessage); }); it('hides the message when the unit is hidden from students', function() { renderContainerPage(this, mockContainerXBlockHtml, { - currently_visible_to_students: true + currently_visible_to_students: true, + has_changes: false }); fetch({ currently_visible_to_students: false }); expect(containerPage.$(messageSelector).text().trim()).toBe(''); @@ -526,10 +557,11 @@ define(["jquery", "underscore", "underscore.string", "js/spec_helpers/create_sin it('shows a message when a unit is made visible', function() { renderContainerPage(this, mockContainerXBlockHtml, { - currently_visible_to_students: false + currently_visible_to_students: false, + has_changes: false }); fetch({ currently_visible_to_students: true }); - expect(containerPage.$(messageSelector).text().trim()).toBe(warningMessage); + expect(containerPage.$(messageSelector).text().trim()).toBe(unchangedWarningMessage); }); }); }); diff --git a/cms/static/js/views/pages/container_subviews.js b/cms/static/js/views/pages/container_subviews.js index 21c0ccd76a..587952b2c0 100644 --- a/cms/static/js/views/pages/container_subviews.js +++ b/cms/static/js/views/pages/container_subviews.js @@ -38,12 +38,13 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "js/views/utils/ }, shouldRefresh: function(model) { - return ViewUtils.hasChangedAttributes(model, ['currently_visible_to_students']); + return ViewUtils.hasChangedAttributes(model, ['currently_visible_to_students', 'has_changes']); }, render: function() { this.$el.html(this.template({ - currentlyVisibleToStudents: this.model.get('currently_visible_to_students') + currentlyVisibleToStudents: this.model.get('currently_visible_to_students'), + hasChanges: this.model.get('has_changes') })); return this; } @@ -116,6 +117,7 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "js/views/utils/ published: this.model.get('published'), publishedOn: this.model.get('published_on'), publishedBy: this.model.get('published_by'), + released: this.model.get('released_to_students'), releaseDate: this.model.get('release_date'), releaseDateFrom: this.model.get('release_date_from') })); @@ -144,7 +146,7 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "js/views/utils/ e.preventDefault(); } ViewUtils.confirmThenRunOperation(gettext("Discard Changes"), - gettext("Are you sure you want to discard changes and revert to the last published version?"), + gettext("Are you sure you want to revert to the last published version of the unit? You cannot undo this action."), gettext("Discard Changes"), function () { ViewUtils.runOperationShowingMessage(gettext('Discarding Changes…'), @@ -187,14 +189,14 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "js/views/utils/ this.checkStaffLock(enableStaffLock); if (enableStaffLock) { - ViewUtils.runOperationShowingMessage(gettext('Setting Staff Lock…'), + ViewUtils.runOperationShowingMessage(gettext('Hiding Unit from Students…'), _.bind(saveAndPublishStaffLock, self)); } else { - ViewUtils.confirmThenRunOperation(gettext("Remove Staff Lock"), - gettext("Are you sure you want to remove the staff lock? Once you publish this unit, it will be released to students on the release date."), - gettext("Remove Staff Lock"), + ViewUtils.confirmThenRunOperation(gettext("Make Visible to Students"), + gettext("If you make this unit visible to students, students will be able to see its content after the release date has passed and you have published the unit. Do you want to proceed?"), + gettext("Make Visible to Students"), function() { - ViewUtils.runOperationShowingMessage(gettext('Removing Staff Lock…'), + ViewUtils.runOperationShowingMessage(gettext('Making Visible to Students…'), _.bind(saveAndPublishStaffLock, self)); }, function() { diff --git a/cms/static/js/views/xblock_outline.js b/cms/static/js/views/xblock_outline.js index c63eb3d66b..7f0a86b827 100644 --- a/cms/static/js/views/xblock_outline.js +++ b/cms/static/js/views/xblock_outline.js @@ -55,6 +55,7 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "js/views/utils/ childInfo = xblockInfo.get('child_info'), parentInfo = this.parentInfo, xblockType = this.getXBlockType(this.model.get('category'), this.parentInfo), + xblockTypeDisplayName = this.getXBlockType(this.model.get('category'), this.parentInfo, true), parentType = parentInfo ? this.getXBlockType(parentInfo.get('category')) : null, addChildName = null, defaultNewChildName = null, @@ -72,6 +73,7 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "js/views/utils/ typeListClass: XBlockViewUtils.getXBlockListTypeClass(xblockType), parentInfo: this.parentInfo, xblockType: xblockType, + xblockTypeDisplayName: xblockTypeDisplayName, parentType: parentType, childType: childInfo ? this.getXBlockType(childInfo.category, xblockInfo) : null, childCategory: childInfo ? childInfo.category : null, diff --git a/cms/templates/container.html b/cms/templates/container.html index 3cc167da39..d6825fa1aa 100644 --- a/cms/templates/container.html +++ b/cms/templates/container.html @@ -88,7 +88,7 @@ templates = ["basic-modal", "modal-button", "edit-xblock-modal", % if is_unit_page: @@ -36,7 +36,7 @@

You haven't added any content to this course yet. - + Add Section

diff --git a/cms/templates/js/publish-xblock.underscore b/cms/templates/js/publish-xblock.underscore index 8d9ddc809d..4133c9f1b0 100644 --- a/cms/templates/js/publish-xblock.underscore +++ b/cms/templates/js/publish-xblock.underscore @@ -1,11 +1,11 @@ <% var title = gettext("Draft (Never published)"); if (visibilityState === 'staff_only') { - title = gettext("Unpublished (Staff only)"); + title = gettext("Visible to Staff Only"); } else if (visibilityState === 'live') { title = gettext("Published and Live"); } else if (published && !hasChanges) { - title = gettext("Published"); + title = gettext("Published (not yet released)"); } else if (published && hasChanges) { title = gettext("Draft (Unpublished changes)"); } @@ -57,7 +57,13 @@ var visibleToStaffOnly = visibilityState === 'staff_only';
-
<%= gettext("Will Be Visible To:") %>
+
+ <% if (released && published && !hasChanges) { %> + <%= gettext("Is Visible To:") %> + <% } else { %> + <%= gettext("Will Be Visible To:") %> + <% } %> +
<% if (visibleToStaffOnly) { %>

<%= gettext("Staff Only") %>

<% } else { %> diff --git a/cms/templates/js/xblock-outline.underscore b/cms/templates/js/xblock-outline.underscore index 582a59642c..c2032cd710 100644 --- a/cms/templates/js/xblock-outline.underscore +++ b/cms/templates/js/xblock-outline.underscore @@ -6,7 +6,8 @@
<% if (includesChildren) { %> -

+

<% } else { %>

@@ -52,7 +53,8 @@

<%= gettext("You haven't added any content to this course yet.") %> + data-parent="<%= xblockInfo.get('id') %>" data-default-name="<%= defaultNewChildName %>" + title="<%= interpolate(gettext('Click to add a new %(xblock_type)s'), { xblock_type: defaultNewChildName }, true) %>" > <%= addChildLabel %>

@@ -64,7 +66,8 @@ <% if (childType) { %> diff --git a/cms/templates/js/xblock-string-field-editor.underscore b/cms/templates/js/xblock-string-field-editor.underscore index 731b9df046..4e357f948d 100644 --- a/cms/templates/js/xblock-string-field-editor.underscore +++ b/cms/templates/js/xblock-string-field-editor.underscore @@ -1,10 +1,14 @@ - +
<% var formLabel = gettext("Edit %(display_name)s (required)"); %> diff --git a/common/test/acceptance/pages/studio/container.py b/common/test/acceptance/pages/studio/container.py index f502dcb789..a33d48a16e 100644 --- a/common/test/acceptance/pages/studio/container.py +++ b/common/test/acceptance/pages/studio/container.py @@ -122,7 +122,8 @@ class ContainerPage(PageObject): if not warnings.is_present(): return False warning_text = warnings.first.text[0] - return warning_text == "This content is live for students. Edit with caution." + return (warning_text == "This unit is visible to students. If you edit the unit, you must re-publish it for students to see your changes." + or warning_text == "Caution: The last published version of this unit is live. By publishing changes you will change the student experience.") @property def publish_action(self): @@ -161,7 +162,7 @@ class ContainerPage(PageObject): def view_published_version(self): """ - Clicks "View Published Version", which will open the published version of the unit page in the LMS. + Clicks "View Live Version", which will open the published version of the unit page in the LMS. Switches the browser to the newly opened LMS window. """ diff --git a/common/test/acceptance/tests/test_studio_container.py b/common/test/acceptance/tests/test_studio_container.py index 2803eeb646..1230347387 100644 --- a/common/test/acceptance/tests/test_studio_container.py +++ b/common/test/acceptance/tests/test_studio_container.py @@ -379,10 +379,10 @@ class UnitPublishingTest(ContainerBase): """ __test__ = True - PUBLISHED_STATUS = "Publishing Status\nPublished" + PUBLISHED_STATUS = "Publishing Status\nPublished (not yet released)" PUBLISHED_LIVE_STATUS = "Publishing Status\nPublished and Live" DRAFT_STATUS = "Publishing Status\nDraft (Unpublished changes)" - LOCKED_STATUS = "Publishing Status\nUnpublished (Staff only)" + LOCKED_STATUS = "Publishing Status\nVisible to Staff Only" RELEASE_TITLE_RELEASED = "RELEASED:" RELEASE_TITLE_RELEASE = "RELEASE:" @@ -673,11 +673,11 @@ class UnitPublishingTest(ContainerBase): Scenario: The publish title displays correctly for units that are not live Given I have a published unit with no unpublished changes that releases in the future When I go to the unit page in Studio - Then the title in the Publish information box is "Published" + Then the title in the Publish information box is "Published (not yet released)" And when I add a component to the unit Then the title in the Publish information box is "Draft (Unpublished changes)" And when I click the Publish button - Then the title in the Publish information box is "Published" + Then the title in the Publish information box is "Published (not yet released)" """ unit = self.go_to_unit_page('Unreleased Section', 'Unreleased Subsection', 'Unreleased Unit') self._verify_publish_title(unit, self.PUBLISHED_STATUS)