Commit 77af8604 by kimth

Begin transplant of executeProblemScripts

parent 8956e5bc
...@@ -77,6 +77,10 @@ class @Problem ...@@ -77,6 +77,10 @@ class @Problem
render: (content) -> render: (content) ->
if content if content
@el.html(content) @el.html(content)
JavascriptLoader.executeModuleScripts @el, () =>
@setupInputTypes()
@bind()
@queueing()
@executeProblemScripts () => @executeProblemScripts () =>
@setupInputTypes() @setupInputTypes()
@bind() @bind()
...@@ -84,6 +88,10 @@ class @Problem ...@@ -84,6 +88,10 @@ class @Problem
else else
$.postWithPrefix "#{@url}/problem_get", (response) => $.postWithPrefix "#{@url}/problem_get", (response) =>
@el.html(response.html) @el.html(response.html)
JavascriptLoader.executeModuleScripts @el, () =>
@setupInputTypes()
@bind()
@queueing()
@executeProblemScripts () => @executeProblemScripts () =>
@setupInputTypes() @setupInputTypes()
@bind() @bind()
......
class @JavascriptLoader class @JavascriptLoader
###
Set of library functions that provide common interface for javascript loading # Set of library functions that provide common interface for javascript loading
for all module types. All functionality provided by JavascriptLoader should take # for all module types. All functionality provided by JavascriptLoader should take
place at module scope, i.e. don't run jQuery over entire page # place at module scope, i.e. don't run jQuery over entire page
###
# executeModuleScripts:
# Scan module contents for "script_placeholder"s, then:
# 1) Fetch each script from server
# 2) Explicitly attach the script to the <head> of document
# 3) Explicitly wait for each script to be loaded
# 4) Return to callback function when all scripts loaded
@executeModuleScripts: (el, callback=null) ->
console.log('executeModuleScripts')
# setCollapsibles:
# Scan module contents for generic collapsible containers
@setCollapsibles: (el) => @setCollapsibles: (el) =>
### ###
el: jQuery object representing xmodule el: jQuery object representing xmodule
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment