Commit 0f18b740 by Andy Armstrong

Move pipeline_js Django app into CMS

Note: this used to be in common, but it was only used in Studio.
parent dda92d13
...@@ -32,6 +32,10 @@ cms/static/xmodule_js ...@@ -32,6 +32,10 @@ cms/static/xmodule_js
lms/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 # 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/annotatable/display_spec.js
common/lib/xmodule/xmodule/js/spec/capa/display_spec.js common/lib/xmodule/xmodule/js/spec/capa/display_spec.js
......
""" """
Views for returning XModule JS (used by requirejs) Views for returning XModule JS (used by requirejs)
""" """
import json import json
from django.conf import settings from django.conf import settings
from django.http import HttpResponse from django.http import HttpResponse
from django.contrib.staticfiles.storage import staticfiles_storage from django.contrib.staticfiles.storage import staticfiles_storage
from edxmako.shortcuts import render_to_response from edxmako.shortcuts import render_to_response
...@@ -12,15 +15,15 @@ def get_xmodule_urls(): ...@@ -12,15 +15,15 @@ def get_xmodule_urls():
""" """
Returns a list of the URLs to hit to grab all the XModule JS 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: if settings.DEBUG:
paths = [path.replace(".coffee", ".js") for path in paths = [path.replace(".coffee", ".js") for path in pipeline_js_settings["source_filenames"]]
settings.PIPELINE_JS['module-js']['source_filenames']]
else: else:
paths = [settings.PIPELINE_JS['module-js']['output_filename']] paths = [pipeline_js_settings["output_filename"]]
return [staticfiles_storage.url(path) for path in paths] 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 View function that returns XModule URLs as a JSON list; meant to be used
as an API as an API
...@@ -29,7 +32,7 @@ def xmodule_js_files(request): ...@@ -29,7 +32,7 @@ def xmodule_js_files(request):
return HttpResponse(json.dumps(urls), content_type="application/json") 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 View function that returns a requirejs-wrapped Javascript file that
loads all the XModule URLs; meant to be loaded via requireJS loads all the XModule URLs; meant to be loaded via requireJS
......
...@@ -226,6 +226,7 @@ SOCIAL_SHARING_SETTINGS = { ...@@ -226,6 +226,7 @@ SOCIAL_SHARING_SETTINGS = {
PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /edx-platform/cms PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /edx-platform/cms
REPO_ROOT = PROJECT_ROOT.dirname() REPO_ROOT = PROJECT_ROOT.dirname()
COMMON_ROOT = REPO_ROOT / "common" COMMON_ROOT = REPO_ROOT / "common"
CMS_ROOT = REPO_ROOT / "cms"
LMS_ROOT = REPO_ROOT / "lms" LMS_ROOT = REPO_ROOT / "lms"
ENV_ROOT = REPO_ROOT.dirname() # virtualenv dir /edx-platform is in ENV_ROOT = REPO_ROOT.dirname() # virtualenv dir /edx-platform is in
...@@ -249,8 +250,8 @@ MAKO_TEMPLATES['main'] = [ ...@@ -249,8 +250,8 @@ MAKO_TEMPLATES['main'] = [
PROJECT_ROOT / 'templates', PROJECT_ROOT / 'templates',
COMMON_ROOT / 'templates', COMMON_ROOT / 'templates',
COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates', COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates',
COMMON_ROOT / 'djangoapps' / 'pipeline_js' / 'templates',
COMMON_ROOT / 'static', # required to statically include common Underscore 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(): for namespace, template_dirs in lms.envs.common.MAKO_TEMPLATES.iteritems():
......
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