Convert xblock_validation.js to webpack
This commit is contained in:
@@ -16,3 +16,9 @@ LOGGING['handlers']['local'] = LOGGING['handlers']['tracking'] = {
|
||||
}
|
||||
|
||||
LOGGING['loggers']['tracking']['handlers'] = ['console']
|
||||
|
||||
# Point the URL used to test YouTube availability to our stub YouTube server
|
||||
BOK_CHOY_HOST = os.environ['BOK_CHOY_HOSTNAME']
|
||||
YOUTUBE['API'] = "http://{}:{}/get_youtube_api/".format(BOK_CHOY_HOST, YOUTUBE_PORT)
|
||||
YOUTUBE['METADATA_URL'] = "http://{}:{}/test_youtube/".format(BOK_CHOY_HOST, YOUTUBE_PORT)
|
||||
YOUTUBE['TEXT_API']['url'] = "{}:{}/test_transcripts_youtube/".format(BOK_CHOY_HOST, YOUTUBE_PORT)
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
'js/factories/settings_graders',
|
||||
'js/factories/textbooks',
|
||||
'js/factories/videos_index',
|
||||
'js/factories/xblock_validation'
|
||||
]),
|
||||
/**
|
||||
* By default all the configuration for optimization happens from the command
|
||||
|
||||
8
cms/static/js/pages/xblock_validation.js
Normal file
8
cms/static/js/pages/xblock_validation.js
Normal file
@@ -0,0 +1,8 @@
|
||||
define(
|
||||
['js/factories/xblock_validation', 'common/js/utils/page_factory'],
|
||||
function(XBlockValidationFactory, invokePageFactory) {
|
||||
'use strict';
|
||||
invokePageFactory('XBlockValidationFactory', XBlockValidationFactory);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -135,7 +135,7 @@ define(['jquery', 'underscore', 'common/js/components/utils/view_utils', 'js/vie
|
||||
this.updateHtml(element, html);
|
||||
return this.addXBlockFragmentResources(resources);
|
||||
} catch (e) {
|
||||
console.error(e.stack);
|
||||
console.error(e, e.stack);
|
||||
return $.Deferred().resolve();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -27,17 +27,13 @@ block_is_unit = is_unit(xblock)
|
||||
</script>
|
||||
</%block>
|
||||
|
||||
<script>
|
||||
require(["jquery", "js/factories/xblock_validation"], function($, XBlockValidationFactory) {
|
||||
XBlockValidationFactory(
|
||||
${messages | n, dump_js_escaped_json},
|
||||
${bool(xblock_url) | n, dump_js_escaped_json}, // xblock_url will be None or a string
|
||||
${bool(is_root) | n, dump_js_escaped_json}, // is_root will be None or a boolean
|
||||
${bool(block_is_unit) | n, dump_js_escaped_json}, // block_is_unit will be None or a boolean
|
||||
$('div.xblock-validation-messages[data-locator="${xblock.location | n, js_escaped_string}"]')
|
||||
);
|
||||
});
|
||||
</script>
|
||||
<%static:webpack page_name="js/pages/xblock_validation" class_name="XBlockValidationFactory">
|
||||
${messages | n, dump_js_escaped_json},
|
||||
${bool(xblock_url) | n, dump_js_escaped_json}, // xblock_url will be None or a string
|
||||
${bool(is_root) | n, dump_js_escaped_json}, // is_root will be None or a boolean
|
||||
${bool(block_is_unit) | n, dump_js_escaped_json}, // block_is_unit will be None or a boolean
|
||||
$('div.xblock-validation-messages[data-locator="${xblock.location | n, js_escaped_string}"]')
|
||||
</%static:webpack>
|
||||
|
||||
% if isinstance(xblock, (XModule, XModuleDescriptor)):
|
||||
<%static:webpack entry="${getattr(xblock.__class__, 'unmixed_class', xblock.__class__).__name__}"/>
|
||||
|
||||
@@ -16,3 +16,9 @@ LOGGING['handlers']['local'] = LOGGING['handlers']['tracking'] = {
|
||||
}
|
||||
|
||||
LOGGING['loggers']['tracking']['handlers'] = ['console']
|
||||
|
||||
# Point the URL used to test YouTube availability to our stub YouTube server
|
||||
BOK_CHOY_HOST = os.environ['BOK_CHOY_HOSTNAME']
|
||||
YOUTUBE['API'] = "http://{}:{}/get_youtube_api/".format(BOK_CHOY_HOST, YOUTUBE_PORT)
|
||||
YOUTUBE['METADATA_URL'] = "http://{}:{}/test_youtube/".format(BOK_CHOY_HOST, YOUTUBE_PORT)
|
||||
YOUTUBE['TEXT_API']['url'] = "{}:{}/test_transcripts_youtube/".format(BOK_CHOY_HOST, YOUTUBE_PORT)
|
||||
|
||||
@@ -34,6 +34,7 @@ module.exports = {
|
||||
'js/pages/textbooks': './cms/static/js/pages/textbooks.js',
|
||||
'js/pages/container': './cms/static/js/pages/container.js',
|
||||
'js/pages/library': './cms/static/js/pages/library.js',
|
||||
'js/pages/xblock_validation': './cms/static/js/pages/xblock_validation.js',
|
||||
'js/sock': './cms/static/js/sock.js',
|
||||
|
||||
// LMS
|
||||
@@ -318,6 +319,7 @@ module.exports = {
|
||||
'cms/djangoapps/pipeline_js/js',
|
||||
'cms/static',
|
||||
'cms/static/cms/js',
|
||||
'lms/static',
|
||||
'common/lib/xmodule',
|
||||
'common/lib/xmodule/xmodule/js/src',
|
||||
'common/static',
|
||||
|
||||
Reference in New Issue
Block a user