Merge pull request #6765 from edx/andya/requirejs-in-lms

Add RequireJS to the LMS
This commit is contained in:
Andy Armstrong
2015-01-27 17:57:33 -05:00
23 changed files with 740 additions and 35 deletions

View File

@@ -380,7 +380,7 @@ MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
EMBARGO_SITE_REDIRECT_URL = None
############################### Pipeline #######################################
STATICFILES_STORAGE = 'cms.lib.django_require.staticstorage.OptimizedCachedRequireJsStorage'
STATICFILES_STORAGE = 'django_require.staticstorage.OptimizedCachedRequireJsStorage'
from rooted_paths import rooted_glob
@@ -520,7 +520,7 @@ REQUIRE_BASE_URL = "./"
# A sensible value would be 'app.build.js'. Leave blank to use the built-in default build profile.
# Set to False to disable running the default profile (e.g. if only using it to build Standalone
# Modules)
REQUIRE_BUILD_PROFILE = "build.js"
REQUIRE_BUILD_PROFILE = "build-studio.js"
# The name of the require.js script used by your project, relative to REQUIRE_BASE_URL.
REQUIRE_JS = "js/vendor/require.js"

View File

@@ -30,6 +30,11 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
LMS_BASE = "localhost:8000"
FEATURES['PREVIEW_LMS_BASE'] = "preview." + LMS_BASE
########################### PIPELINE #################################
# Skip RequireJS optimizer in development
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
############################# ADVANCED COMPONENTS #############################
# Make it easier to test advanced components in local dev

View File

@@ -1,13 +0,0 @@
"""
:class:`~django_require.staticstorage.OptimizedCachedRequireJsStorage`
"""
from pipeline.storage import PipelineCachedStorage
from require.storage import OptimizedFilesMixin
class OptimizedCachedRequireJsStorage(OptimizedFilesMixin, PipelineCachedStorage):
"""
Custom storage backend that is used by Django-require.
"""
pass

View File

@@ -61,7 +61,7 @@
* As of 2.1.10, mainConfigFile can be an array of values, with the last
* value's config take precedence over previous values in the array.
*/
mainConfigFile: 'require-config.js',
mainConfigFile: 'require-config-studio.js',
/**
* Set paths for modules. If relative paths, set relative to baseUrl above.
* If a special value of "empty:" is used for the path value, then that

View File

@@ -56,7 +56,7 @@ import json
var require = {baseUrl: window.baseUrl};
</script>
<script type="text/javascript" src="${static.url("js/vendor/require.js")}"></script>
<script type="text/javascript" src="${static.url("require-config.js")}"></script>
<script type="text/javascript" src="${static.url("require-config-studio.js")}"></script>
## js templates
<script id="system-feedback-tpl" type="text/template">