diff --git a/cms/envs/common.py b/cms/envs/common.py index adfc3bf2b0..60d47a7a4f 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -197,12 +197,13 @@ for descriptor in XModuleDescriptor.load_classes() + [RawDescriptor]: module_js = descriptor.module_class.get_javascript() for filetype in ('coffee', 'js'): - for fragment in descriptor_js.get(filetype, []) + module_js.get(filetype, []): - fragments.add((filetype, fragment)) + for idx, fragment in enumerate(descriptor_js.get(filetype, []) + module_js.get(filetype, [])): + fragments.add((idx, filetype, fragment)) module_js_sources = [] -for filetype, fragment in fragments: - path = os.path.join(js_file_dir, "{hash}.{type}".format( +for idx, filetype, fragment in sorted(fragments): + path = os.path.join(js_file_dir, "{idx}-{hash}.{type}".format( + idx=idx, hash=hashlib.md5(fragment).hexdigest(), type=filetype)) with open(path, 'w') as js_file: diff --git a/lms/static/coffee/src/_subview.coffee b/common/lib/xmodule/xmodule/js/src/video/display/_subview.coffee similarity index 100% rename from lms/static/coffee/src/_subview.coffee rename to common/lib/xmodule/xmodule/js/src/video/display/_subview.coffee diff --git a/lms/envs/common.py b/lms/envs/common.py index 3edcf2f197..00266e6b17 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -346,12 +346,13 @@ fragments = set() for descriptor in XModuleDescriptor.load_classes() + [HiddenDescriptor]: module_js = descriptor.module_class.get_javascript() for filetype in ('coffee', 'js'): - for fragment in js.get(filetype, []): - fragments.add((filetype, fragment)) + for idx, fragment in enumerate(module_js.get(filetype, [])): + fragments.add((idx, filetype, fragment)) module_js_sources = [] -for filetype, fragment in fragments: - path = os.path.join(js_file_dir, "{hash}.{type}".format( +for idx, filetype, fragment in sorted(fragments): + path = os.path.join(js_file_dir, "{idx}-{hash}.{type}".format( + idx=idx, hash=hashlib.md5(fragment).hexdigest(), type=filetype)) with open(path, 'w') as js_file: