diff --git a/cms/djangoapps/contentstore/features/studio-overview-togglesection.feature b/cms/djangoapps/contentstore/features/studio-overview-togglesection.feature index d9d7414648..5276b90d12 100644 --- a/cms/djangoapps/contentstore/features/studio-overview-togglesection.feature +++ b/cms/djangoapps/contentstore/features/studio-overview-togglesection.feature @@ -21,12 +21,12 @@ Feature: Overview Toggle Section Then I see the "Collapse All Sections" link And all sections are expanded - Scenario: Collapse link is removed after last section of a course is deleted + Scenario: Collapse link is not removed after last section of a course is deleted Given I have a course with 1 section And I navigate to the course overview page When I press the "section" delete icon And I confirm the alert - Then I do not see the "Collapse All Sections" link + Then I see the "Collapse All Sections" link Scenario: Collapsing all sections when all sections are expanded Given I navigate to the courseware page of a course with multiple sections diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index add42436dc..063c69e950 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -475,7 +475,7 @@ def preview_module_system(request, preview_id, descriptor): ) -def get_preview_module(request, preview_id, location): +def get_preview_module(request, preview_id, descriptor): """ Returns a preview XModule at the specified location. The preview_data is chosen arbitrarily from the set of preview data for the descriptor specified by Location @@ -484,7 +484,6 @@ def get_preview_module(request, preview_id, location): preview_id (str): An identifier specifying which preview this module is used for location: A Location """ - descriptor = modulestore().get_item(location) instance_state, shared_state = descriptor.get_sample_state()[0] return load_preview_module(request, preview_id, descriptor, instance_state, shared_state) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index 729c4dc2e9..9f7e3a5e60 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -55,7 +55,7 @@ class CMS.Views.ModuleEdit extends Backbone.View clickSaveButton: (event) => event.preventDefault() data = @module.save() - data.metadata = _.extend(data.metadata, @metadata()) + data.metadata = _.extend(data.metadata || {}, @metadata()) @hideModal() @model.save(data).done( => # # showToastMessage("Your changes have been saved.", null, 3) diff --git a/cms/static/img/Explanation-example.png b/cms/static/img/Explanation-example.png new file mode 100644 index 0000000000..2dbc2b3b96 Binary files /dev/null and b/cms/static/img/Explanation-example.png differ diff --git a/cms/static/img/header-example.png b/cms/static/img/header-example.png new file mode 100644 index 0000000000..732e816a15 Binary files /dev/null and b/cms/static/img/header-example.png differ diff --git a/cms/templates/widgets/problem-edit.html b/cms/templates/widgets/problem-edit.html index c263cad5ed..fcd946c5d0 100644 --- a/cms/templates/widgets/problem-edit.html +++ b/cms/templates/widgets/problem-edit.html @@ -14,9 +14,13 @@ class="problem-editor-icon number">
  • +
  • +
  • @@ -29,6 +33,17 @@ diff --git a/common/lib/xmodule/xmodule/abtest_module.py b/common/lib/xmodule/xmodule/abtest_module.py index 3091b6ec02..12456bc7d7 100644 --- a/common/lib/xmodule/xmodule/abtest_module.py +++ b/common/lib/xmodule/xmodule/abtest_module.py @@ -52,9 +52,10 @@ class ABTestModule(XModule): def get_shared_state(self): return json.dumps({'group': self.group}) - def get_children_locations(self): - return self.definition['data']['group_content'][self.group] - + def get_child_descriptors(self): + active_locations = set(self.definition['data']['group_content'][self.group]) + return [desc for desc in self.descriptor.get_children() if desc.location.url() in active_locations] + def displayable_items(self): # Most modules return "self" as the displayable_item. We never display ourself # (which is why we don't implement get_html). We only display our children. diff --git a/common/lib/xmodule/xmodule/css/problem/edit.scss b/common/lib/xmodule/xmodule/css/problem/edit.scss index ba5a87feb4..bce0cca390 100644 --- a/common/lib/xmodule/xmodule/css/problem/edit.scss +++ b/common/lib/xmodule/xmodule/css/problem/edit.scss @@ -45,11 +45,32 @@ } } + .advanced-toggle { + @include white-button; + height: auto; + margin-top: -1px; + padding: 3px 9px; + font-size: 12px; + + &.current { + border: 1px solid $lightGrey !important; + border-radius: 3px !important; + background: $lightGrey !important; + color: $darkGrey !important; + pointer-events: none; + cursor: none; + + &:hover { + box-shadow: 0 0 0 0 !important; + } + } + } + .cheatsheet-toggle { width: 21px; height: 21px; padding: 0; - margin: 3px 5px 0 16px; + margin: 0 5px 0 15px; border-radius: 22px; border: 1px solid #a5aaaf; background: #e5ecf3; diff --git a/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee b/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee index 55fcb9adbf..5217385d80 100644 --- a/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee +++ b/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee @@ -70,6 +70,22 @@ describe 'MarkdownEditingDescriptor', -> revisedSelection = MarkdownEditingDescriptor.insertSelect('my text') expect(revisedSelection).toEqual('[[my text]]') + describe 'insertHeader', -> + it 'inserts the template if selection is empty', -> + revisedSelection = MarkdownEditingDescriptor.insertHeader('') + expect(revisedSelection).toEqual(MarkdownEditingDescriptor.headerTemplate) + it 'wraps existing text', -> + revisedSelection = MarkdownEditingDescriptor.insertHeader('my text') + expect(revisedSelection).toEqual('my text\n====\n') + + describe 'insertExplanation', -> + it 'inserts the template if selection is empty', -> + revisedSelection = MarkdownEditingDescriptor.insertExplanation('') + expect(revisedSelection).toEqual(MarkdownEditingDescriptor.explanationTemplate) + it 'wraps existing text', -> + revisedSelection = MarkdownEditingDescriptor.insertExplanation('my text') + expect(revisedSelection).toEqual('[explanation]\nmy text\n[explanation]') + describe 'markdownToXml', -> it 'converts raw text to paragraph', -> data = MarkdownEditingDescriptor.markdownToXml('foo') @@ -257,8 +273,6 @@ describe 'MarkdownEditingDescriptor', -> [(] distractor [] no space - {{video abcd1s}} - Option with multiple correct ones [[one option, (correct one), (should not be correct)]] @@ -312,8 +326,6 @@ describe 'MarkdownEditingDescriptor', -> -