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
244584ce
Commit
244584ce
authored
Jan 15, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DnD for subsections and units (no auto open)
parent
e8bcc172
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
cms/static/js/base.js
+22
-3
No files found.
cms/static/js/base.js
View file @
244584ce
...
@@ -93,14 +93,17 @@ $(document).ready(function() {
...
@@ -93,14 +93,17 @@ $(document).ready(function() {
$
(
'.subsection-list > ol'
).
sortable
({
$
(
'.subsection-list > ol'
).
sortable
({
axis
:
'y'
,
axis
:
'y'
,
handle
:
'.section-item .drag-handle'
,
handle
:
'.section-item .drag-handle'
,
update
:
onSubsectionReordered
update
:
onSubsectionReordered
,
connectWith
:
'.subsection-list > ol'
,
revert
:
true
});
});
// Section reordering
// Section reordering
$
(
'.courseware-overview'
).
sortable
({
$
(
'.courseware-overview'
).
sortable
({
axis
:
'y'
,
axis
:
'y'
,
handle
:
'header .drag-handle'
,
handle
:
'header .drag-handle'
,
update
:
onSectionReordered
update
:
onSectionReordered
,
revert
:
true
});
});
$
(
'.new-course-button'
).
bind
(
'click'
,
addNewCourse
);
$
(
'.new-course-button'
).
bind
(
'click'
,
addNewCourse
);
...
@@ -277,7 +280,7 @@ function onUnitReordered(event, ui) {
...
@@ -277,7 +280,7 @@ function onUnitReordered(event, ui) {
}
}
}
}
function
onSubsectionReordered
()
{
function
onSubsectionReordered
(
event
,
ui
)
{
var
section_id
=
$
(
this
).
data
(
'section-id'
);
var
section_id
=
$
(
this
).
data
(
'section-id'
);
var
_els
=
$
(
this
).
children
(
'li:.branch'
);
var
_els
=
$
(
this
).
children
(
'li:.branch'
);
...
@@ -291,6 +294,22 @@ function onSubsectionReordered() {
...
@@ -291,6 +294,22 @@ function onSubsectionReordered() {
contentType
:
"application/json"
,
contentType
:
"application/json"
,
data
:
JSON
.
stringify
({
'id'
:
section_id
,
'children'
:
children
})
data
:
JSON
.
stringify
({
'id'
:
section_id
,
'children'
:
children
})
});
});
// remove from old container
if
(
ui
.
sender
&&
section_id
!==
ui
.
sender
.
data
(
'section-id'
))
{
var
_els
=
ui
.
sender
.
children
(
'li:.branch'
);
var
children
=
_els
.
map
(
function
(
idx
,
el
)
{
return
$
(
el
).
data
(
'id'
);
}).
get
();
// call into server to commit the new order
$
.
ajax
({
url
:
"/save_item"
,
type
:
"POST"
,
dataType
:
"json"
,
contentType
:
"application/json"
,
data
:
JSON
.
stringify
({
'id'
:
ui
.
sender
.
data
(
'section-id'
),
'children'
:
children
})
});
}
}
}
function
onSectionReordered
()
{
function
onSectionReordered
()
{
...
...
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