forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openedx#18341 from edx/revert-18290-switch-contain…
…er-factory-to-webpack Revert "Switch container factory to webpack"
- Loading branch information
Showing
158 changed files
with
6,598 additions
and
7,161 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 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,45 @@ | ||
## 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", | ||
"jquery.tinymce", "jquery.qtip", "jquery.scrollTo", "jquery.flot", | ||
"jquery.cookie", | ||
"utility"], | ||
function($, _, CodeMirror, tinymce) { | ||
window.$ = $; | ||
window._ = _; | ||
require(['mathjax']); | ||
window.CodeMirror = CodeMirror; | ||
window.RequireJS = { | ||
'requirejs': requirejs, | ||
'require': require, | ||
'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} | ||
**/ | ||
var requireQueue = function(modules) { | ||
var deferred = $.Deferred(); | ||
var loadScript = function (queue) { | ||
// Loads the next script if queue is not empty. | ||
if (queue.length) { | ||
require([queue.shift()], function() { | ||
loadScript(queue); | ||
}); | ||
} else { | ||
deferred.resolve(); | ||
} | ||
}; | ||
|
||
loadScript(modules.concat()); | ||
return deferred.promise(); | ||
}; | ||
|
||
return requireQueue(${urls}); | ||
}); |
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,10 @@ | ||
""" | ||
URL patterns for Javascript files used to load all of the XModule JS in one wad. | ||
""" | ||
from django.conf.urls import url | ||
from pipeline_js.views import xmodule_js_files, requirejs_xmodule | ||
|
||
urlpatterns = [ | ||
url(r'^files\.json$', xmodule_js_files, name='xmodule_js_files'), | ||
url(r'^xmodule\.js$', requirejs_xmodule, name='requirejs_xmodule'), | ||
] |
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,44 @@ | ||
""" | ||
Views for returning XModule JS (used by requirejs) | ||
""" | ||
|
||
import json | ||
|
||
from django.conf import settings | ||
from django.contrib.staticfiles.storage import staticfiles_storage | ||
from django.http import HttpResponse | ||
|
||
from edxmako.shortcuts import render_to_response | ||
|
||
|
||
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] | ||
|
||
|
||
def xmodule_js_files(request): # pylint: disable=unused-argument | ||
""" | ||
View function that returns XModule URLs as a JSON list; meant to be used | ||
as an API | ||
""" | ||
urls = get_xmodule_urls() | ||
return HttpResponse(json.dumps(urls), content_type="application/json") | ||
|
||
|
||
def requirejs_xmodule(request): # pylint: disable=unused-argument | ||
""" | ||
View function that returns a requirejs-wrapped Javascript file that | ||
loads all the XModule URLs; meant to be loaded via requireJS | ||
""" | ||
return render_to_response( | ||
"xmodule.js", | ||
{"urls": get_xmodule_urls()}, | ||
content_type="text/javascript", | ||
) |
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.