forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reapply the XBlock RequireJS -> Webpack changes
- Loading branch information
1 parent
9375bda
commit 07a15c6
Showing
162 changed files
with
7,347 additions
and
6,724 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// This file is designed to load all the XModule Javascript files in one wad | ||
// using requirejs. It is passed through the Mako template system, which | ||
// populates the `urls` variable with a list of paths to XModule JS files. | ||
// These files assume that several libraries are available and bound to | ||
// variables in the global context, so we load those libraries with requirejs | ||
// and attach them to the global context manually. | ||
define( | ||
[ | ||
'jquery', 'underscore', 'codemirror', 'tinymce', 'scriptjs', | ||
'jquery.tinymce', 'jquery.qtip', 'jquery.scrollTo', 'jquery.flot', | ||
'jquery.cookie', | ||
'utility' | ||
], | ||
function($, _, CodeMirror, tinymce, $script) { | ||
'use strict'; | ||
|
||
window.$ = $; | ||
window._ = _; | ||
$script( | ||
'//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js' + | ||
'?config=TeX-MML-AM_SVG&delayStartupUntil=configured', | ||
'mathjax' | ||
); | ||
window.CodeMirror = CodeMirror; | ||
window.RequireJS = { | ||
requirejs: {}, // This is never used by current xmodules | ||
require: $script, // $script([deps], callback) acts approximately like the require function | ||
define: define | ||
}; | ||
/** | ||
* Loads all modules one-by-one in exact order. | ||
* The module should be used until we'll use RequireJS for XModules. | ||
* @param {Array} modules A list of urls. | ||
* @return {jQuery Promise} | ||
**/ | ||
function requireQueue(modules) { | ||
var deferred = $.Deferred(); | ||
function loadScript(queue) { | ||
$script.ready('mathjax', function() { | ||
// Loads the next script if queue is not empty. | ||
if (queue.length) { | ||
$script([queue.shift()], function() { | ||
loadScript(queue); | ||
}); | ||
} else { | ||
deferred.resolve(); | ||
} | ||
}); | ||
} | ||
|
||
loadScript(modules.concat()); | ||
return deferred.promise(); | ||
} | ||
|
||
// if (!window.xmoduleUrls) { | ||
// throw Error('window.xmoduleUrls must be defined'); | ||
// } | ||
return requireQueue([]); | ||
} | ||
); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
""" | ||
Utilities for returning XModule JS (used by requirejs) | ||
""" | ||
|
||
from django.conf import settings | ||
from django.contrib.staticfiles.storage import staticfiles_storage | ||
|
||
|
||
def get_xmodule_urls(): | ||
""" | ||
Returns a list of the URLs to hit to grab all the XModule JS | ||
""" | ||
pipeline_js_settings = settings.PIPELINE_JS["module-js"] | ||
if settings.DEBUG: | ||
paths = [path.replace(".coffee", ".js") for path in pipeline_js_settings["source_filenames"]] | ||
else: | ||
paths = [pipeline_js_settings["output_filename"]] | ||
return [staticfiles_storage.url(path) for path in paths] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.