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
3acf394d
Commit
3acf394d
authored
10 years ago
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for scripts defined in common xmodule code to execute.
STUD-1792
parent
0b398c89
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
36 deletions
+48
-36
cms/templates/container.html
+9
-10
cms/templates/edit-tabs.html
+12
-10
cms/templates/unit.html
+16
-14
common/djangoapps/pipeline_js/templates/xmodule.js
+11
-2
No files found.
cms/templates/container.html
View file @
3acf394d
...
...
@@ -32,19 +32,18 @@ main_xblock_info = {
<script
type=
'text/javascript'
>
require
([
"domReady!"
,
"jquery"
,
"js/models/xblock_info"
,
"js/views/pages/container"
,
"js/collections/component_template"
,
"xmodule"
,
"coffee/src/main"
,
"xblock/cms.runtime.v1"
],
function
(
doc
,
$
,
XBlockInfo
,
ContainerPage
,
ComponentTemplates
)
{
var
view
,
mainXBlockInfo
;
function
(
doc
,
$
,
XBlockInfo
,
ContainerPage
,
ComponentTemplates
,
xmoduleLoader
)
{
var
templates
=
new
ComponentTemplates
(
$
{
component_templates
|
n
},
{
parse
:
true
});
var
mainXBlockInfo
=
new
XBlockInfo
(
$
{
json
.
dumps
(
main_xblock_info
)
|
n
});
mainXBlockInfo
=
new
XBlockInfo
(
$
{
json
.
dumps
(
main_xblock_info
)
|
n
});
view
=
new
ContainerPage
({
el
:
$
(
'#content'
),
model
:
mainXBlockInfo
,
templates
:
templates
xmoduleLoader
.
done
(
function
()
{
var
view
=
new
ContainerPage
({
el
:
$
(
'#content'
),
model
:
mainXBlockInfo
,
templates
:
templates
});
view
.
render
();
});
view
.
render
();
});
</script>
...
...
This diff is collapsed.
Click to expand it.
cms/templates/edit-tabs.html
View file @
3acf394d
...
...
@@ -21,16 +21,18 @@
<script
type=
'text/javascript'
>
require
([
"js/models/explicit_url"
,
"coffee/src/views/tabs"
,
"xmodule"
,
"coffee/src/main"
,
"xblock/cms.runtime.v1"
],
function
(
TabsModel
,
TabsEditView
)
{
var
model
=
new
TabsModel
({
id
:
"${context_course.location}"
,
explicit_url
:
"${reverse('contentstore.views.tabs_handler', kwargs={'course_key_string': context_course.id})}"
});
new
TabsEditView
({
el
:
$
(
'.tab-list'
),
model
:
model
,
mast
:
$
(
'.wrapper-mast'
)
function
(
TabsModel
,
TabsEditView
,
xmoduleLoader
)
{
xmoduleLoader
.
done
(
function
()
{
var
model
=
new
TabsModel
({
id
:
"${context_course.location}"
,
explicit_url
:
"${reverse('contentstore.views.tabs_handler', kwargs={'course_key_string': context_course.id})}"
});
new
TabsEditView
({
el
:
$
(
'.tab-list'
),
model
:
model
,
mast
:
$
(
'.wrapper-mast'
)
});
});
});
</script>
...
...
This diff is collapsed.
Click to expand it.
cms/templates/unit.html
View file @
3acf394d
...
...
@@ -21,25 +21,27 @@ from django.utils.translation import ugettext as _
<
%
block
name=
"jsextra"
>
<script
type=
'text/javascript'
>
require
([
"domReady!"
,
"jquery"
,
"js/models/module_info"
,
"coffee/src/views/unit"
,
"js/collections/component_template"
,
"
jquery.ui"
,
"xmodule
"
,
"coffee/src/main"
,
"xblock/cms.runtime.v1"
],
function
(
doc
,
$
,
ModuleModel
,
UnitEditView
,
ComponentTemplates
)
{
"
xmodule"
,
"jquery.ui
"
,
"coffee/src/main"
,
"xblock/cms.runtime.v1"
],
function
(
doc
,
$
,
ModuleModel
,
UnitEditView
,
ComponentTemplates
,
xmoduleLoader
)
{
window
.
unit_location_analytics
=
'${unit_usage_key}'
;
var
templates
=
new
ComponentTemplates
(
$
{
component_templates
|
n
},
{
parse
:
true
});
new
UnitEditView
({
el
:
$
(
'.main-wrapper'
),
view
:
'unit'
,
model
:
new
ModuleModel
({
id
:
'${unit_usage_key}'
,
state
:
'${unit_state}'
}),
templates
:
templates
});
xmoduleLoader
.
done
(
function
()
{
new
UnitEditView
({
el
:
$
(
'.main-wrapper'
),
view
:
'unit'
,
model
:
new
ModuleModel
({
id
:
'${unit_usage_key}'
,
state
:
'${unit_state}'
}),
templates
:
templates
});
$
(
'.new-component-template'
).
each
(
function
(){
$emptyEditor
=
$
(
this
).
find
(
'.empty'
);
$
(
this
).
prepend
(
$emptyEditor
);
$
(
'.new-component-template'
).
each
(
function
(){
$emptyEditor
=
$
(
this
).
find
(
'.empty'
);
$
(
this
).
prepend
(
$emptyEditor
);
});
});
});
</script>
...
...
This diff is collapsed.
Click to expand it.
common/djangoapps/pipeline_js/templates/xmodule.js
View file @
3acf394d
...
...
@@ -21,8 +21,17 @@ define(["jquery", "underscore", "mathjax", "codemirror", "tinymce",
var
urls
=
$
{
urls
};
var
head
=
$
(
"head"
);
$
.
each
(
urls
,
function
(
i
,
url
)
{
var
deferred
=
$
.
Deferred
();
var
numResources
=
urls
.
length
;
$
.
each
(
urls
,
function
(
i
,
url
)
{
head
.
append
(
$
(
"<script/>"
,
{
src
:
url
}));
// Wait for all the scripts to execute.
require
([
url
],
function
()
{
if
(
i
===
numResources
-
1
)
{
deferred
.
resolve
();
}
});
});
return
window
.
XModule
;
return
deferred
.
promise
();
});
This diff is collapsed.
Click to expand it.
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