diff --git a/cms/envs/common.py b/cms/envs/common.py index adfc3bf2b07a83fce41d088168bd960804e0f698..60d47a7a4fe08fcaf41033dbb9a49085e43eeb8f 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 3edcf2f197c3b8140d8de9467b8062adf50919ce..00266e6b1710e61a5d08593296c3dff194dcbf3f 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: