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
3a2c5752
Commit
3a2c5752
authored
Jan 15, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic dnd for units
parent
c9c9f7e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
cms/static/js/base.js
+21
-2
No files found.
cms/static/js/base.js
View file @
3a2c5752
...
...
@@ -59,7 +59,9 @@ $(document).ready(function() {
$
(
'.sortable-unit-list'
).
sortable
({
axis
:
'y'
,
handle
:
'.drag-handle'
,
update
:
onUnitReordered
update
:
onUnitReordered
,
connectWith
:
'.sortable-unit-list'
,
revert
:
true
});
// expand/collapse methods for optional date setters
...
...
@@ -242,7 +244,7 @@ function removePolicyMetadata(e) {
// This method only changes the ordering of the child objects in a subsection
function
onUnitReordered
()
{
function
onUnitReordered
(
event
,
ui
)
{
var
subsection_id
=
$
(
this
).
data
(
'subsection-id'
);
var
_els
=
$
(
this
).
children
(
'li:.leaf'
);
...
...
@@ -256,6 +258,23 @@ function onUnitReordered() {
contentType
:
"application/json"
,
data
:
JSON
.
stringify
({
'id'
:
subsection_id
,
'children'
:
children
})
});
// remove from old container
if
(
ui
.
sender
&&
subsection_id
!==
ui
.
sender
.
data
(
'subsection-id'
))
{
var
_els
=
ui
.
sender
.
children
(
'li:.leaf'
);
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
(
'subsection-id'
),
'children'
:
children
})
});
}
}
function
onSubsectionReordered
()
{
...
...
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