-
+

You haven't added any content to this course yet. diff --git a/cms/templates/js/publish-xblock.underscore b/cms/templates/js/publish-xblock.underscore index f9b30bcb38c1..b956dcd2d4a5 100644 --- a/cms/templates/js/publish-xblock.underscore +++ b/cms/templates/js/publish-xblock.underscore @@ -1,31 +1,43 @@ <% -var publishClasses = ""; -var title = gettext("Draft (Never published)"); -if (published) { - if (published && hasChanges) { - publishClasses = publishClasses + " is-draft"; - title = gettext("Draft (Unpublished changes)"); - } else { - publishClasses = publishClasses + " is-published"; - title = gettext("Published"); - } -} -if (releaseDate) { - publishClasses = publishClasses + " is-scheduled"; +var publishClass = ''; +if (publishState === 'staff_only') { + publishClass = 'is-staff-only'; +} else if (publishState === 'live') { + publishClass = 'is-live is-published is-released'; +} else if (publishState === 'ready') { + publishClass = 'is-ready is-published'; +} else if (publishState === 'has_unpublished_content') { + publishClass = 'has-warnings'; } -if (visibleToStaffOnly) { - publishClasses = publishClasses + " is-staff-only"; + +var title = gettext("Draft (Never published)"); +if (publishState === 'staff_only') { title = gettext("Unpublished (Staff only)"); +} else if (publishState === 'live' || publishState === 'ready') { + title = gettext("Published"); +} else if (publishState === 'has_unpublished_content') { + title = gettext("Draft (Unpublished changes)"); } + +var releaseLabel = gettext("Release:"); +if (publishState === 'live') { + releaseLabel = gettext("Released:"); +} else if (publishState === 'ready') { + releaseLabel = gettext("Scheduled:"); +} + +var canPublish = publishState !== 'ready' && publishState !== 'live'; +var canDiscardChanges = publishState === 'has_unpublished_content'; +var visibleToStaffOnly = publishState === 'staff_only'; %> -

+

<%= gettext("Publishing Status") %> <%= title %>

- <% if (hasChanges && editedOn && editedBy) { + <% if (publishState === 'has_unpublished_changes' && editedOn && editedBy) { var message = gettext("Draft saved on %(last_saved_date)s by %(edit_username)s") %> <%= interpolate(message, { last_saved_date: '' + editedOn + '', @@ -42,17 +54,7 @@ if (visibleToStaffOnly) {

-
- <% if (published && releaseDate) { - if (releasedToStudents) { %> - <%= gettext("Released:") %> - <% } else { %> - <%= gettext("Scheduled:") %> - <% } - } else { %> - <%= gettext("Release:") %> - <% } %> -
+
<%= releaseLabel %>

<% if (releaseDate) { %> <% var message = gettext("%(release_date)s with %(section_or_subsection)s") %> @@ -87,12 +89,12 @@ if (visibleToStaffOnly) {

  • - <%= gettext("Publish") %>
  • - <%= gettext("Discard Changes") %>
  • diff --git a/cms/templates/js/unit-outline.underscore b/cms/templates/js/unit-outline.underscore index 70d3cf4123f7..ae30d8d565f3 100644 --- a/cms/templates/js/unit-outline.underscore +++ b/cms/templates/js/unit-outline.underscore @@ -1,27 +1,50 @@ +<% +var publishState = xblockInfo.get('publish_state'); +var publishClass = ''; +if (publishState === 'staff_only') { + publishClass = 'is-staff-only'; +} else if (publishState === 'live') { + publishClass = 'is-live'; +} else if (publishState === 'ready') { + publishClass = 'is-ready'; +} else if (publishState === 'has_unpublished_content') { + publishClass = 'has_warnings'; +} + +var listType = 'list-for-' + xblockType; +if (xblockType === 'course') { + listType = 'list-sections'; +} else if (xblockType === 'section') { + listType = 'list-subsections'; +} else if (xblockType === 'subsection') { + listType = 'list-units'; +} +%> <% if (parentInfo) { %> -
  • -
    - <% } %> -
      -
    - - <% if (childType) { %> - - <% } %> +
    +
      +
    + <% if (childType) { %> + + <% } %> +
    <% if (parentInfo) { %> -
  • + <% } %> diff --git a/cms/templates/js/xblock-outline.underscore b/cms/templates/js/xblock-outline.underscore index 2dec21afd66b..6772f3cf32f1 100644 --- a/cms/templates/js/xblock-outline.underscore +++ b/cms/templates/js/xblock-outline.underscore @@ -1,5 +1,5 @@ <% if (parentInfo) { %> -
  • diff --git a/common/lib/xmodule/xmodule/modulestore/__init__.py b/common/lib/xmodule/xmodule/modulestore/__init__.py index b2bc7b0eaf2c..c8f1892fc692 100644 --- a/common/lib/xmodule/xmodule/modulestore/__init__.py +++ b/common/lib/xmodule/xmodule/modulestore/__init__.py @@ -89,11 +89,11 @@ class UserID(object): # user ID to use for tests that do not have a django user available test = -3 -class PublishState(object): - """ - The publish state for a given xblock-- either 'draft', 'private', or 'public'. - Currently in CMS, an xblock can only be in 'draft' or 'private' if it is at or below the Unit level. +class LegacyPublishState(object): + """ + The legacy publish state for a given xblock-- either 'draft', 'private', or 'public'. These states + are no longer used in Studio directly, but are still referenced in a few places. """ draft = 'draft' private = 'private' @@ -522,7 +522,7 @@ def compute_publish_state(self, xblock): """ Returns PublishState.public since this is a read-only store. """ - return PublishState.public + return LegacyPublishState.public def heartbeat(self): """ diff --git a/common/lib/xmodule/xmodule/modulestore/mongo/draft.py b/common/lib/xmodule/xmodule/modulestore/mongo/draft.py index 63f960da5b84..99529080e01c 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo/draft.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo/draft.py @@ -11,7 +11,7 @@ from opaque_keys.edx.locations import Location from xmodule.exceptions import InvalidVersionError -from xmodule.modulestore import PublishState, ModuleStoreEnum +from xmodule.modulestore import LegacyPublishState, ModuleStoreEnum from xmodule.modulestore.exceptions import ( ItemNotFoundError, DuplicateItemError, InvalidBranchSetting, DuplicateCourseError ) @@ -601,7 +601,7 @@ def has_changes(self, location): return False # don't check children if this block has changes (is not public) - if self.compute_publish_state(item) != PublishState.public: + if self.compute_publish_state(item) != LegacyPublishState.public: return True # if this block doesn't have changes, then check its children elif item.has_children: @@ -780,10 +780,10 @@ def compute_publish_state(self, xblock): Returns whether this xblock is draft, public, or private. Returns: - PublishState.draft - content is in the process of being edited, but still has a previous + LegacyPublishState.draft - content is in the process of being edited, but still has a previous version deployed to LMS - PublishState.public - content is locked and deployed to LMS - PublishState.private - content is editable and not deployed to LMS + LegacyPublishState.public - content is locked and deployed to LMS + LegacyPublishState.private - content is editable and not deployed to LMS """ if getattr(xblock, 'is_draft', False): published_xblock_location = as_published(xblock.location) @@ -791,11 +791,11 @@ def compute_publish_state(self, xblock): {'_id': published_xblock_location.to_deprecated_son()} ) if published_item is None: - return PublishState.private + return LegacyPublishState.private else: - return PublishState.draft + return LegacyPublishState.draft else: - return PublishState.public + return LegacyPublishState.public def _verify_branch_setting(self, expected_branch_setting): """ diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py index 844fee3ffcf4..90a000fc6d7e 100644 --- a/common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py +++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py @@ -4,9 +4,8 @@ from ..exceptions import ItemNotFoundError from split import SplitMongoModuleStore -from xmodule.modulestore import ModuleStoreEnum, PublishState +from xmodule.modulestore import ModuleStoreEnum, LegacyPublishState from xmodule.modulestore.draft_and_published import ModuleStoreDraftAndPublished -from xmodule.modulestore.draft import DIRECT_ONLY_CATEGORIES class DraftVersioningModuleStore(ModuleStoreDraftAndPublished, SplitMongoModuleStore): @@ -159,9 +158,9 @@ def compute_publish_state(self, xblock): Returns whether this xblock is draft, public, or private. Returns: - PublishState.draft - published exists and is different from draft - PublishState.public - published exists and is the same as draft - PublishState.private - no published version exists + LegacyPublishState.draft - published exists and is different from draft + LegacyPublishState.public - published exists and is the same as draft + LegacyPublishState.private - no published version exists """ # TODO figure out what to say if xblock is not from the HEAD of its branch def get_head(branch): @@ -172,7 +171,7 @@ def get_head(branch): try: other = get_head(ModuleStoreEnum.BranchName.published) except ItemNotFoundError: - return PublishState.private + return LegacyPublishState.private elif xblock.location.branch == ModuleStoreEnum.BranchName.published: other = get_head(ModuleStoreEnum.BranchName.draft) else: @@ -180,13 +179,13 @@ def get_head(branch): if not other: if xblock.location.branch == ModuleStoreEnum.BranchName.draft: - return PublishState.private + return LegacyPublishState.private else: - return PublishState.public + return LegacyPublishState.public elif xblock.update_version != other['edit_info']['update_version']: - return PublishState.draft + return LegacyPublishState.draft else: - return PublishState.public + return LegacyPublishState.public def convert_to_draft(self, location, user_id): """