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
4946d601
Commit
4946d601
authored
Aug 21, 2014
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Verify children are rendered before allowing drop into collapsed parent.
TNL-56
parent
a3c2a54b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
+23
-7
cms/static/js/utils/drag_and_drop.js
+8
-2
cms/static/js/views/course_outline.js
+6
-3
cms/static/js/views/xblock_outline.js
+9
-2
No files found.
cms/static/js/utils/drag_and_drop.js
View file @
4946d601
...
...
@@ -260,6 +260,10 @@ define(["jquery", "jquery.ui", "underscore", "gettext", "js/views/feedback_notif
},
expandElement
:
function
(
ele
)
{
// Verify all children of the element are rendered.
var
ensureChildrenRendered
=
ele
.
data
(
'ensureChildrenRendered'
);
if
(
_
.
isFunction
(
ensureChildrenRendered
))
{
ensureChildrenRendered
();
}
// Update classes.
ele
.
removeClass
(
this
.
collapsedClass
);
ele
.
find
(
'.expand-collapse'
).
first
().
removeClass
(
'expand'
).
addClass
(
'collapse'
);
},
...
...
@@ -354,7 +358,8 @@ define(["jquery", "jquery.ui", "underscore", "gettext", "js/views/feedback_notif
handleClass
:
null
,
droppableClass
:
null
,
parentLocationSelector
:
null
,
refresh
:
null
refresh
:
null
,
ensureChildrenRendered
:
null
},
options
);
if
(
$
(
element
).
data
(
'droppable-class'
)
!==
options
.
droppableClass
)
{
...
...
@@ -362,7 +367,8 @@ define(["jquery", "jquery.ui", "underscore", "gettext", "js/views/feedback_notif
'droppable-class'
:
options
.
droppableClass
,
'parent-location-selector'
:
options
.
parentLocationSelector
,
'child-selector'
:
options
.
type
,
'refresh'
:
options
.
refresh
'refresh'
:
options
.
refresh
,
'ensureChildrenRendered'
:
options
.
ensureChildrenRendered
});
draggable
=
new
Draggabilly
(
element
,
{
...
...
cms/static/js/views/course_outline.js
View file @
4946d601
...
...
@@ -168,7 +168,8 @@ define(["jquery", "underscore", "js/views/xblock_outline", "js/views/utils/view_
handleClass
:
'.section-drag-handle'
,
droppableClass
:
'ol.list-sections'
,
parentLocationSelector
:
'article.outline'
,
refresh
:
this
.
refreshWithCollapsedState
.
bind
(
this
)
refresh
:
this
.
refreshWithCollapsedState
.
bind
(
this
),
ensureChildrenRendered
:
this
.
ensureChildrenRendered
.
bind
(
this
)
});
}
else
if
(
$
(
element
).
hasClass
(
"outline-subsection"
))
{
...
...
@@ -177,7 +178,8 @@ define(["jquery", "underscore", "js/views/xblock_outline", "js/views/utils/view_
handleClass
:
'.subsection-drag-handle'
,
droppableClass
:
'ol.list-subsections'
,
parentLocationSelector
:
'li.outline-section'
,
refresh
:
this
.
refreshWithCollapsedState
.
bind
(
this
)
refresh
:
this
.
refreshWithCollapsedState
.
bind
(
this
),
ensureChildrenRendered
:
this
.
ensureChildrenRendered
.
bind
(
this
)
});
}
else
if
(
$
(
element
).
hasClass
(
"outline-unit"
))
{
...
...
@@ -186,7 +188,8 @@ define(["jquery", "underscore", "js/views/xblock_outline", "js/views/utils/view_
handleClass
:
'.unit-drag-handle'
,
droppableClass
:
'ol.list-units'
,
parentLocationSelector
:
'li.outline-subsection'
,
refresh
:
this
.
refreshWithCollapsedState
.
bind
(
this
)
refresh
:
this
.
refreshWithCollapsedState
.
bind
(
this
),
ensureChildrenRendered
:
this
.
ensureChildrenRendered
.
bind
(
this
)
});
}
}
...
...
cms/static/js/views/xblock_outline.js
View file @
4946d601
...
...
@@ -149,10 +149,17 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "js/views/utils/
}
}
// Ensure that the children have been rendered before expanding
if
(
this
.
shouldRenderChildren
()
&&
!
this
.
renderedChildren
)
{
this
.
ensureChildrenRendered
();
BaseView
.
prototype
.
toggleExpandCollapse
.
call
(
this
,
event
);
},
/**
* Verifies that the children are rendered (if they should be).
*/
ensureChildrenRendered
:
function
()
{
if
(
!
this
.
renderedChildren
&&
this
.
shouldRenderChildren
())
{
this
.
renderChildren
();
}
BaseView
.
prototype
.
toggleExpandCollapse
.
call
(
this
,
event
);
},
/**
...
...
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