diff --git a/cms/djangoapps/contentstore/views/item.py b/cms/djangoapps/contentstore/views/item.py index 5baf93c53ad9..d8f2a89bf542 100644 --- a/cms/djangoapps/contentstore/views/item.py +++ b/cms/djangoapps/contentstore/views/item.py @@ -1191,6 +1191,7 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F 'group_access': xblock.group_access, 'user_partitions': user_partitions, 'show_correctness': xblock.show_correctness, + 'icon': xblock.icon, }) if xblock.category == 'sequential': diff --git a/cms/static/js/models/xblock_info.js b/cms/static/js/models/xblock_info.js index 78eaaddea234..108dfcb283a1 100644 --- a/cms/static/js/models/xblock_info.js +++ b/cms/static/js/models/xblock_info.js @@ -53,6 +53,10 @@ function(Backbone, _, str, ModuleUtils) { * True if the xblock is a parentable xblock. */ has_children: null, + /** + * Meta icon of the unit. + */ + icons: null, /** * True if the xblock has changes. * Note: this is not always provided as a performance optimization. It is only provided for diff --git a/cms/static/js/spec/views/pages/course_outline_spec.js b/cms/static/js/spec/views/pages/course_outline_spec.js index dc5fec49dbb0..b79ebf31c15d 100644 --- a/cms/static/js/spec/views/pages/course_outline_spec.js +++ b/cms/static/js/spec/views/pages/course_outline_spec.js @@ -270,7 +270,7 @@ describe('CourseOutlinePage', function() { 'staff-lock-editor', 'unit-access-editor', 'content-visibility-editor', 'settings-modal-tabs', 'timed-examination-preference-editor', 'access-editor', 'show-correctness-editor', 'highlights-editor', 'highlights-enable-editor', - 'course-highlights-enable' + 'course-highlights-enable', 'icon-editor' ]); appendSetFixtures(mockOutlinePage); mockCourseJSON = createMockCourseJSON({}, [ diff --git a/cms/static/js/views/modals/course_outline_modals.js b/cms/static/js/views/modals/course_outline_modals.js index 6bff80e9772b..81be502b5404 100644 --- a/cms/static/js/views/modals/course_outline_modals.js +++ b/cms/static/js/views/modals/course_outline_modals.js @@ -15,7 +15,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', 'use strict'; var CourseOutlineXBlockModal, SettingsXBlockModal, PublishXBlockModal, HighlightsXBlockModal, AbstractEditor, BaseDateEditor, - ReleaseDateEditor, DueDateEditor, GradingEditor, PublishEditor, AbstractVisibilityEditor, + ReleaseDateEditor, DueDateEditor, IconEditor, GradingEditor, PublishEditor, AbstractVisibilityEditor, StaffLockEditor, UnitAccessEditor, ContentVisibilityEditor, TimedExaminationPreferenceEditor, AccessEditor, ShowCorrectnessEditor, HighlightsEditor, HighlightsEnableXBlockModal, HighlightsEnableEditor; @@ -371,6 +371,29 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', } }); + IconEditor = BaseDateEditor.extend({ + fieldName: 'icon', + templateName: 'icon-editor', + + hasChanges: function() { + return this.model.get("icon") != parseInt(this.$('#icon').val()); + }, + + getValue: function () { + return (parseInt(this.$('#icon').val())); + }, + + getRequestData: function () { + return this.hasChanges() ? { + publish: 'republish', + metadata: { + 'icon': this.getValue() + } + } : {}; + } + }); + + ReleaseDateEditor = BaseDateEditor.extend({ fieldName: 'start', templateName: 'release-date-editor', @@ -1049,9 +1072,23 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', displayName: gettext('Advanced'), editors: [] }; - if (xblockInfo.isVertical()) { - editors = [StaffLockEditor, UnitAccessEditor]; - } else { + + var special_exam_editors = []; + if (xblockInfo.isChapter()) { + editors = [ReleaseDateEditor, StaffLockEditor]; + } else if (xblockInfo.isSequential()) { + editors = [ReleaseDateEditor, GradingEditor, DueDateEditor]; + + var enable_special_exams = (options.enable_proctored_exams || options.enable_timed_exams); + if (enable_special_exams) { + special_exam_editors.push(TimedExaminationPreferenceEditor); + } + + editors.push(StaffLockEditor); + + } else if (xblockInfo.isVertical()) { + editors = [StaffLockEditor, UnitAccessEditor, IconEditor]; + } else { tabs = [ { name: 'basic', diff --git a/cms/templates/course_outline.html b/cms/templates/course_outline.html index b5dfd0e2197f..56c24a89b726 100644 --- a/cms/templates/course_outline.html +++ b/cms/templates/course_outline.html @@ -26,7 +26,7 @@ <%block name="header_extras"> -% for template_name in ['course-outline', 'xblock-string-field-editor', 'basic-modal', 'modal-button', 'course-outline-modal', 'due-date-editor', 'release-date-editor', 'grading-editor', 'publish-editor', 'staff-lock-editor', 'unit-access-editor', 'content-visibility-editor', 'verification-access-editor', 'timed-examination-preference-editor', 'access-editor', 'settings-modal-tabs', 'show-correctness-editor', 'highlights-editor', 'highlights-enable-editor', 'course-highlights-enable']: +% for template_name in ['course-outline', 'xblock-string-field-editor', 'basic-modal', 'modal-button', 'course-outline-modal', 'due-date-editor', 'release-date-editor', 'grading-editor', 'publish-editor', 'staff-lock-editor', 'unit-access-editor', 'content-visibility-editor', 'verification-access-editor', 'timed-examination-preference-editor', 'access-editor', 'settings-modal-tabs', 'show-correctness-editor', 'highlights-editor', 'highlights-enable-editor', 'course-highlights-enable', 'icon-editor']: diff --git a/cms/templates/js/icon-editor.underscore b/cms/templates/js/icon-editor.underscore new file mode 100644 index 000000000000..626ed3208ac8 --- /dev/null +++ b/cms/templates/js/icon-editor.underscore @@ -0,0 +1,11 @@ + + diff --git a/common/lib/xmodule/xmodule/modulestore/inheritance.py b/common/lib/xmodule/xmodule/modulestore/inheritance.py index f847146a33bb..08a9f691013e 100644 --- a/common/lib/xmodule/xmodule/modulestore/inheritance.py +++ b/common/lib/xmodule/xmodule/modulestore/inheritance.py @@ -46,6 +46,12 @@ class InheritanceMixin(XBlockMixin): help=_("Enter the default date by which problems are due."), scope=Scope.settings, ) + icon = Integer( + display_name=_("Icon"), + default=0, + help=_("XBlock Icon ID"), + scope=Scope.settings, + ) visible_to_staff_only = Boolean( help=_("If true, can be seen only by course staff, regardless of start date."), default=False, diff --git a/common/lib/xmodule/xmodule/seq_module.py b/common/lib/xmodule/xmodule/seq_module.py index 9290c9daaad8..247572e3396a 100644 --- a/common/lib/xmodule/xmodule/seq_module.py +++ b/common/lib/xmodule/xmodule/seq_module.py @@ -34,7 +34,7 @@ # HACK: This shouldn't be hard-coded to two types # OBSOLETE: This obsoletes 'type' -class_priority = ['video', 'problem'] +class_priority = ['interactive', 'wistia', 'video', 'problem'] # Make '_' a no-op so we can scrape strings. Using lambda instead of # `django.utils.translation.ugettext_noop` because Django cannot be imported in this file @@ -475,7 +475,8 @@ def _render_student_view_for_items(self, context, display_items, fragment): 'id': text_type(usage_id), 'bookmarked': is_bookmarked, 'path': " > ".join(display_names + [item.display_name_with_default]), - 'graded': item.graded + 'graded': item.graded, + 'icon': item.icon, } if is_user_authenticated: