Merge pull request #13664 from edx/andya/common-refactoring
Move pipeline_js Django app into CMS
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user