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
7ce547f0
Commit
7ce547f0
authored
Aug 20, 2014
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for "ui-sortable" existing in HTML within HTML module.
parent
7130c14f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
cms/static/js/views/container.js
+15
-9
cms/templates/js/mock/mock-container-xblock.underscore
+3
-3
No files found.
cms/static/js/views/container.js
View file @
7ce547f0
define
([
"jquery"
,
"underscore"
,
"js/views/xblock"
,
"js/utils/module"
,
"gettext"
,
"js/views/feedback_notification"
,
"jquery.ui"
],
// The container view uses sortable, which is provided by jquery.ui.
function
(
$
,
_
,
XBlockView
,
ModuleUtils
,
gettext
,
NotificationView
)
{
var
reorderableClass
=
'.reorderable-container'
,
sortableInitializedClass
=
'.ui-sortable'
,
studioXBlockWrapperClass
=
'.studio-xblock-wrapper'
;
var
studioXBlockWrapperClass
=
'.studio-xblock-wrapper'
;
var
ContainerView
=
XBlockView
.
extend
({
// Store the request token of the first xblock on the page (which we know was rendered by Studio when
// the page was generated). Use that request token to filter out user-defined HTML in any
// child xblocks within the page.
requestToken
:
""
,
xblockReady
:
function
()
{
XBlockView
.
prototype
.
xblockReady
.
call
(
this
);
var
reorderableContainer
=
this
.
$
(
reorderableClass
),
alreadySortable
=
this
.
$
(
sortableInitializedClass
),
newParent
,
oldParent
,
self
=
this
;
var
reorderableClass
,
reorderableContainer
,
newParent
,
oldParent
,
self
=
this
;
alreadySortable
.
sortable
(
"destroy"
);
this
.
requestToken
=
this
.
$
(
'div.xblock'
).
first
().
data
(
'request-token'
);
reorderableClass
=
this
.
makeRequestSpecificSelector
(
'.reorderable-container'
);
reorderableContainer
=
this
.
$
(
reorderableClass
);
reorderableContainer
.
sortable
({
handle
:
'.drag-handle'
,
...
...
@@ -123,7 +124,12 @@ define(["jquery", "underscore", "js/views/xblock", "js/utils/module", "gettext",
},
refresh
:
function
()
{
var
sortableInitializedClass
=
this
.
makeRequestSpecificSelector
(
'.reorderable-container.ui-sortable'
);
this
.
$
(
sortableInitializedClass
).
sortable
(
'refresh'
);
},
makeRequestSpecificSelector
:
function
(
selector
)
{
return
'div.xblock[data-request-token="'
+
this
.
requestToken
+
'"] > '
+
selector
;
}
});
...
...
cms/templates/js/mock/mock-container-xblock.underscore
View file @
7ce547f0
...
...
@@ -10,7 +10,7 @@
</div>
</header>
<article class="xblock-render">
<div class="xblock" data-locator="locator-container"
<div class="xblock" data-locator="locator-container"
data-request-token="page-render-token"
data-init="MockXBlock" data-runtime-class="StudioRuntime" data-runtime-version="1">
<ol class="reorderable-container">
<li class="studio-xblock-wrapper is-draggable" data-locator="locator-group-A">
...
...
@@ -35,7 +35,7 @@
</header>
<article class="xblock-render">
<div class="xblock">
<div class="xblock"
data-request-token="page-render-token"
>
<ol class="reorderable-container">
<li class="studio-xblock-wrapper is-draggable" data-locator="locator-component-A1">
<section class="wrapper-xblock level-element"
...
...
@@ -144,7 +144,7 @@
</header>
<article class="xblock-render">
<div class="xblock">
<div class="xblock"
data-request-token="page-render-token"
>
<ol class="reorderable-container">
<li class="studio-xblock-wrapper is-draggable" data-locator="locator-component-B1">
<section class="wrapper-xblock level-element"
...
...
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