diff --git a/cms/static/js/base.js b/cms/static/js/base.js index 9fa4489c36..888fcef5b8 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -42,6 +42,7 @@ $(document).ready(function() { $('.new-unit-item').bind('click', createNewUnit); $('.collapse-all-button').bind('click', collapseAll); + $('.toggle-button-sections').bind('click', toggleSections); // autosave when a field is updated on the subsection page $body.on('keyup', '.subsection-display-name-input, .unit-subtitle, .policy-list-value', checkForNewValue); @@ -130,6 +131,19 @@ function collapseAll(e) { $('.expand-collapse-icon').removeClass('collapse').addClass('expand'); } +function toggleSections(e) { + e.preventDefault(); + + $section = $('.courseware-section'); + $button = $(this); + $labelCollapsed = $('up Collapse All Sections'); + $labelExpanded = $('down Expand All Sections'); + + $section.toggleClass('collapsed'); + var buttonLabel = $section.hasClass('collapsed') ? $labelExpanded : $labelCollapsed; + $button.toggleClass('is-activated').html(buttonLabel); +} + function editSectionPublishDate(e) { e.preventDefault(); $modal = $('.edit-subsection-publish-settings').show(); diff --git a/cms/static/sass/_courseware.scss b/cms/static/sass/_courseware.scss index e2037916cb..6a8be8e5ea 100644 --- a/cms/static/sass/_courseware.scss +++ b/cms/static/sass/_courseware.scss @@ -512,6 +512,29 @@ input.courseware-unit-search-input { } } +.toggle-button-sections { + position: relative; + float: right; + margin-top: 10px; + + font-size: 13px; + color: $darkGrey; + + .ss-icon { + @include border-radius(20px); + position: relative; + top: -1px; + display: inline-block; + margin-right: 2px; + line-height: 5px; + font-size: 11px; + } + + .label { + display: inline-block; + } +} + .new-section-name, .new-subsection-name-input { width: 515px; diff --git a/cms/templates/overview.html b/cms/templates/overview.html index 2a46908c55..a20531200e 100644 --- a/cms/templates/overview.html +++ b/cms/templates/overview.html @@ -122,7 +122,7 @@
New Section - Collapse All + up Collapse All Sections
% for section in sections: