Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[1/3] refactor: remove XModule JS from Django Pipeline" #32778

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions cms/djangoapps/pipeline_js/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
Utilities for returning XModule JS (used by requirejs)
"""


from django.conf import settings
from django.contrib.staticfiles.storage import staticfiles_storage


def get_xmodule_urls():
"""
Returns a list of the URLs to hit to grab all the XModule JS
"""
pipeline_js_settings = settings.PIPELINE['JAVASCRIPT']["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]
9 changes: 9 additions & 0 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,15 @@
'source_filenames': base_vendor_js,
'output_filename': 'js/cms-base-vendor.js',
},
'module-js': {
'source_filenames': (
rooted_glob(COMMON_ROOT / 'static/', 'xmodule/descriptors/js/*.js') +
rooted_glob(COMMON_ROOT / 'static/', 'xmodule/modules/js/*.js') +
rooted_glob(COMMON_ROOT / 'static/', 'common/js/discussion/*.js')
),
'output_filename': 'js/cms-modules.js',
'test_order': 1
},
}

STATICFILES_IGNORE_PATTERNS = (
Expand Down
8 changes: 8 additions & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2580,6 +2580,14 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring
'source_filenames': main_vendor_js,
'output_filename': 'js/lms-main_vendor.js',
},
'module-descriptor-js': {
'source_filenames': rooted_glob(COMMON_ROOT / 'static/', 'xmodule/descriptors/js/*.js'),
'output_filename': 'js/lms-module-descriptors.js',
},
'module-js': {
'source_filenames': rooted_glob(COMMON_ROOT / 'static', 'xmodule/modules/js/*.js'),
'output_filename': 'js/lms-modules.js',
},
'discussion': {
'source_filenames': discussion_js,
'output_filename': 'js/discussion.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@
<script type="text/javascript" src="${static.url('js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/jQuery-File-Upload/js/jquery.fileupload.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/jquery.qubit.js')}"></script>
<%static:webpack entry='HtmlBlockEditor'/>
<link rel="stylesheet" href="${static.url('css/HtmlBlockEditor.css')}">
<%static:js group='module-descriptor-js'/>
<%static:js group='instructor_dash'/>
<%static:js group='application'/>

Expand Down
1 change: 1 addition & 0 deletions lms/templates/wiki/preview_inline.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ <h1 class="page-header">{{ title }}</h1>
</section>

{% javascript 'application' %}
{% javascript 'module-js' %}
{% with mathjax_mode='wiki' %}
{% include "mathjax_include.html" %}
{% endwith %}
Expand Down
3 changes: 3 additions & 0 deletions xmodule/assets/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,14 @@ Currently, edx-platform XBlock JS is defined both here in `xmodule/assets`_ and
* `VerticalBlock`_
* `LibrarySourcedBlock`_

* Some XBlock JS is also processed through Django Pipeline and used in a couple specific legacy places.

As part of an `active build refactoring`_:

* We update the older builtin XBlocks to reference their JS directly rather than using copies of it.
* We will move ``webpack.xmodule.config.js`` here instead of generating it.
* We will consolidate all edx-platform XBlock JS here in `xmodule/assets`_.
* We will remove XBlock JS from Django Pipeline.
* We will delete the ``xmodule_assets`` script.

.. _xmodule/assets: https://github.com/openedx/edx-platform/tree/master/xmodule/assets
Expand Down
Loading