diff --git a/.eslintignore b/.eslintignore index 120dab4bc1..fd5205ea5f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -32,6 +32,10 @@ cms/static/xmodule_js lms/static/xmodule_js +# Mako templates that generate .js files +cms/djangoapps/pipeline_js/templates + + # This directory is about half Coffee and half JS, things get messy here so just ignore all existing coffee paths common/lib/xmodule/xmodule/js/spec/annotatable/display_spec.js common/lib/xmodule/xmodule/js/spec/capa/display_spec.js diff --git a/common/djangoapps/pipeline_js/__init__.py b/cms/djangoapps/pipeline_js/__init__.py similarity index 100% rename from common/djangoapps/pipeline_js/__init__.py rename to cms/djangoapps/pipeline_js/__init__.py diff --git a/common/djangoapps/pipeline_js/templates/xmodule.js b/cms/djangoapps/pipeline_js/templates/xmodule.js similarity index 100% rename from common/djangoapps/pipeline_js/templates/xmodule.js rename to cms/djangoapps/pipeline_js/templates/xmodule.js diff --git a/common/djangoapps/pipeline_js/urls.py b/cms/djangoapps/pipeline_js/urls.py similarity index 100% rename from common/djangoapps/pipeline_js/urls.py rename to cms/djangoapps/pipeline_js/urls.py diff --git a/common/djangoapps/pipeline_js/views.py b/cms/djangoapps/pipeline_js/views.py similarity index 72% rename from common/djangoapps/pipeline_js/views.py rename to cms/djangoapps/pipeline_js/views.py index d64f17b1a4..922fb6bac6 100644 --- a/common/djangoapps/pipeline_js/views.py +++ b/cms/djangoapps/pipeline_js/views.py @@ -1,10 +1,13 @@ """ Views for returning XModule JS (used by requirejs) """ + import json + from django.conf import settings from django.http import HttpResponse from django.contrib.staticfiles.storage import staticfiles_storage + from edxmako.shortcuts import render_to_response @@ -12,15 +15,15 @@ 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 - settings.PIPELINE_JS['module-js']['source_filenames']] + paths = [path.replace(".coffee", ".js") for path in pipeline_js_settings["source_filenames"]] else: - paths = [settings.PIPELINE_JS['module-js']['output_filename']] + paths = [pipeline_js_settings["output_filename"]] return [staticfiles_storage.url(path) for path in paths] -def xmodule_js_files(request): +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 @@ -29,7 +32,7 @@ def xmodule_js_files(request): return HttpResponse(json.dumps(urls), content_type="application/json") -def requirejs_xmodule(request): +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 diff --git a/cms/envs/common.py b/cms/envs/common.py index 1c82fa4315..a1a25ad9c4 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -226,6 +226,7 @@ SOCIAL_SHARING_SETTINGS = { PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /edx-platform/cms REPO_ROOT = PROJECT_ROOT.dirname() COMMON_ROOT = REPO_ROOT / "common" +CMS_ROOT = REPO_ROOT / "cms" LMS_ROOT = REPO_ROOT / "lms" ENV_ROOT = REPO_ROOT.dirname() # virtualenv dir /edx-platform is in @@ -249,8 +250,8 @@ MAKO_TEMPLATES['main'] = [ PROJECT_ROOT / 'templates', COMMON_ROOT / 'templates', COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates', - COMMON_ROOT / 'djangoapps' / 'pipeline_js' / 'templates', COMMON_ROOT / 'static', # required to statically include common Underscore templates + CMS_ROOT / 'djangoapps' / 'pipeline_js' / 'templates', ] for namespace, template_dirs in lms.envs.common.MAKO_TEMPLATES.iteritems():