Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
b3af587b
Commit
b3af587b
authored
Jan 10, 2013
by
Christina Roberts
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1247 from MITx/feature/btalbot/cms-sectiontoggling
Course Overview Section Collapse/Expand Toggling
parents
bcafc5fd
19fa4393
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
8 deletions
+60
-8
cms/static/js/base.js
+31
-4
cms/static/sass/_courseware.scss
+28
-3
cms/templates/overview.html
+1
-1
No files found.
cms/static/js/base.js
View file @
b3af587b
...
@@ -39,7 +39,13 @@ $(document).ready(function() {
...
@@ -39,7 +39,13 @@ $(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
);
// autosave when a field is updated on the subsection page
// autosave when a field is updated on the subsection page
$body
.
on
(
'keyup'
,
'.subsection-display-name-input, .unit-subtitle, .policy-list-value'
,
checkForNewValue
);
$body
.
on
(
'keyup'
,
'.subsection-display-name-input, .unit-subtitle, .policy-list-value'
,
checkForNewValue
);
...
@@ -123,9 +129,30 @@ $(document).ready(function() {
...
@@ -123,9 +129,30 @@ $(document).ready(function() {
});
});
});
});
function
collapseAll
(
e
)
{
// function collapseAll(e) {
$
(
'.branch'
).
addClass
(
'collapsed'
);
// $('.branch').addClass('collapsed');
$
(
'.expand-collapse-icon'
).
removeClass
(
'collapse'
).
addClass
(
'expand'
);
// $('.expand-collapse-icon').removeClass('collapse').addClass('expand');
// }
function
toggleSections
(
e
)
{
e
.
preventDefault
();
$section
=
$
(
'.courseware-section'
);
sectionCount
=
$section
.
length
;
$button
=
$
(
this
);
$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>'
);
var
buttonLabel
=
$button
.
hasClass
(
'is-activated'
)
?
$labelCollapsed
:
$labelExpanded
;
$button
.
toggleClass
(
'is-activated'
).
html
(
buttonLabel
);
if
(
$button
.
hasClass
(
'is-activated'
))
{
$section
.
addClass
(
'collapsed'
);
$section
.
find
(
'.expand-collapse-icon'
).
removeClass
(
'collapsed'
).
addClass
(
'expand'
);
}
else
{
$section
.
removeClass
(
'collapsed'
);
$section
.
find
(
'.expand-collapse-icon'
).
removeClass
(
'expand'
).
addClass
(
'collapse'
);
}
}
}
function
editSectionPublishDate
(
e
)
{
function
editSectionPublishDate
(
e
)
{
...
...
cms/static/sass/_courseware.scss
View file @
b3af587b
...
@@ -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,14 +509,31 @@ input.courseware-unit-search-input {
...
@@ -501,14 +509,31 @@ input.courseware-unit-search-input {
}
}
}
}
.collapse-all-button
{
.toggle-button-sections
{
display
:
none
;
position
:
relative
;
float
:
right
;
float
:
right
;
margin-top
:
10px
;
margin-top
:
10px
;
font-size
:
13px
;
font-size
:
13px
;
color
:
$darkGrey
;
color
:
$darkGrey
;
.collapse-all-icon
{
&
.is-shown
{
margin-right
:
6px
;
display
:
block
;
}
.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
;
}
}
}
}
...
...
cms/templates/overview.html
View file @
b3af587b
...
@@ -122,7 +122,7 @@
...
@@ -122,7 +122,7 @@
<div
class=
"inner-wrapper"
>
<div
class=
"inner-wrapper"
>
<div
class=
"page-actions"
>
<div
class=
"page-actions"
>
<a
href=
"#"
class=
"new-button new-courseware-section-button"
><span
class=
"plus-icon white"
></span>
New Section
</a>
<a
href=
"#"
class=
"new-button new-courseware-section-button"
><span
class=
"plus-icon white"
></span>
New Section
</a>
<a
href=
"#"
class=
"
collapse-all-button"
><span
class=
"collapse-all-icon"
></span>
Collapse All
</a>
<a
href=
"#"
class=
"
toggle-button toggle-button-sections"
><i
class=
"ss-icon ss-symbolicons-block"
>
up
</i>
<span
class=
"label"
>
Collapse All Sections
</span>
</a>
</div>
</div>
<article
class=
"courseware-overview"
data-course-id=
"${context_course.location.url()}"
>
<article
class=
"courseware-overview"
data-course-id=
"${context_course.location.url()}"
>
% for section in sections:
% for section in sections:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment