Commit 6b8944ad by Brian Talbot

studio - section expanding/collapsing UI - wip

parent ce4994dd
...@@ -41,7 +41,12 @@ $(document).ready(function() { ...@@ -41,7 +41,12 @@ $(document).ready(function() {
$('.unit .item-actions .delete-button').bind('click', deleteUnit); $('.unit .item-actions .delete-button').bind('click', deleteUnit);
$('.new-unit-item').bind('click', createNewUnit); $('.new-unit-item').bind('click', createNewUnit);
$('.collapse-all-button').bind('click', collapseAll); // toggling overview section details
$(function(){
if($('.courseware-section').length > 0) {
$('.toggle-button-sections').addClass('is-shown');
}
});
$('.toggle-button-sections').bind('click', toggleSections); $('.toggle-button-sections').bind('click', toggleSections);
// autosave when a field is updated on the subsection page // autosave when a field is updated on the subsection page
...@@ -135,13 +140,17 @@ function toggleSections(e) { ...@@ -135,13 +140,17 @@ function toggleSections(e) {
e.preventDefault(); e.preventDefault();
$section = $('.courseware-section'); $section = $('.courseware-section');
sectionCount = $section.length;
$button = $(this); $button = $(this);
$labelCollapsed = $('<i class="ss-icon ss-symbolicons-block">up</i> <span class="label">Collapse All Sections</span>'); $labelCollapsed = $('<i class="ss-icon ss-symbolicons-block">up</i> <span class="label">Collapse All Sections</span>');
$labelExpanded = $('<i class="ss-icon ss-symbolicons-block">down</i> <span class="label">Expand All Sections</span>'); $labelExpanded = $('<i class="ss-icon ss-symbolicons-block">down</i> <span class="label">Expand All Sections</span>');
$section.toggleClass('collapsed'); if (sectionCount > 0) {
var buttonLabel = $section.hasClass('collapsed') ? $labelExpanded : $labelCollapsed; $section.toggleClass('collapsed');
$button.toggleClass('is-activated').html(buttonLabel); $section.find('.expand-collapse-icon').toggleClass('collapse expand');
var buttonLabel = $section.hasClass('collapsed') ? $labelExpanded : $labelCollapsed;
$button.toggleClass('is-activated').html(buttonLabel);
}
} }
function editSectionPublishDate(e) { function editSectionPublishDate(e) {
......
...@@ -422,6 +422,14 @@ input.courseware-unit-search-input { ...@@ -422,6 +422,14 @@ input.courseware-unit-search-input {
float: left; float: left;
margin: 29px 6px 16px 16px; margin: 29px 6px 16px 16px;
@include transition(none); @include transition(none);
&.expand {
background-position: 0 0;
}
&.collapsed {
}
} }
.drag-handle { .drag-handle {
...@@ -501,18 +509,8 @@ input.courseware-unit-search-input { ...@@ -501,18 +509,8 @@ input.courseware-unit-search-input {
} }
} }
.collapse-all-button {
float: right;
margin-top: 10px;
font-size: 13px;
color: $darkGrey;
.collapse-all-icon {
margin-right: 6px;
}
}
.toggle-button-sections { .toggle-button-sections {
display: none;
position: relative; position: relative;
float: right; float: right;
margin-top: 10px; margin-top: 10px;
...@@ -520,6 +518,10 @@ input.courseware-unit-search-input { ...@@ -520,6 +518,10 @@ input.courseware-unit-search-input {
font-size: 13px; font-size: 13px;
color: $darkGrey; color: $darkGrey;
&.is-shown {
display: block;
}
.ss-icon { .ss-icon {
@include border-radius(20px); @include border-radius(20px);
position: relative; position: relative;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment