Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cms/djangoapps/contentstore/views/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
4 changes: 4 additions & 0 deletions cms/static/js/models/xblock_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cms/static/js/spec/views/pages/course_outline_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({}, [
Expand Down
45 changes: 41 additions & 4 deletions cms/static/js/views/modals/course_outline_modals.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion cms/templates/course_outline.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<%block name="header_extras">
<link rel="stylesheet" type="text/css" href="${static.url('js/vendor/timepicker/jquery.timepicker.css')}" />
% 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']:
<script type="text/template" id="${template_name}-tpl">
<%static:include path="js/${template_name}.underscore" />
</script>
Expand Down
11 changes: 11 additions & 0 deletions cms/templates/js/icon-editor.underscore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h3 class="modal-section-title">Select icon</h3>
<select id="icon">
<option value="0" <% if (xblockInfo.get("icon") == 0) { %> selected <% } %> >Default icon</option>
<option value="1" <% if (xblockInfo.get("icon") == 1) { %> selected <% } %> >Text</option>
<option value="2" <% if (xblockInfo.get("icon") == 2) { %> selected <% } %> >Video</option>
<option value="3" <% if (xblockInfo.get("icon") == 3) { %> selected <% } %> >Interactive</option>
<option value="4" <% if (xblockInfo.get("icon") == 4) { %> selected <% } %> >Downloadable</option>
<option value="5" <% if (xblockInfo.get("icon") == 5) { %> selected <% } %> >Ask Question</option>
<option value="6" <% if (xblockInfo.get("icon") == 6) { %> selected <% } %> >Asses Question</option>
<option value="7" <% if (xblockInfo.get("icon") == 7) { %> selected <% } %> >Text Box</option>
</select>
6 changes: 6 additions & 0 deletions common/lib/xmodule/xmodule/modulestore/inheritance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions common/lib/xmodule/xmodule/seq_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down