diff --git a/cms/envs/bok_choy_docker.py b/cms/envs/bok_choy_docker.py index 96dd3902cc..cd09b6e95a 100644 --- a/cms/envs/bok_choy_docker.py +++ b/cms/envs/bok_choy_docker.py @@ -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) diff --git a/cms/static/cms/js/build.js b/cms/static/cms/js/build.js index 71976d63be..2112606a1c 100644 --- a/cms/static/cms/js/build.js +++ b/cms/static/cms/js/build.js @@ -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 diff --git a/cms/static/js/pages/xblock_validation.js b/cms/static/js/pages/xblock_validation.js new file mode 100644 index 0000000000..b0a4cb7a7c --- /dev/null +++ b/cms/static/js/pages/xblock_validation.js @@ -0,0 +1,8 @@ +define( + ['js/factories/xblock_validation', 'common/js/utils/page_factory'], + function(XBlockValidationFactory, invokePageFactory) { + 'use strict'; + invokePageFactory('XBlockValidationFactory', XBlockValidationFactory); + } +); + diff --git a/cms/static/js/views/xblock.js b/cms/static/js/views/xblock.js index b6e5e83c4a..2b84e4e8d2 100644 --- a/cms/static/js/views/xblock.js +++ b/cms/static/js/views/xblock.js @@ -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(); } }, diff --git a/cms/templates/studio_xblock_wrapper.html b/cms/templates/studio_xblock_wrapper.html index 18cda07d7a..f4a2e45ac9 100644 --- a/cms/templates/studio_xblock_wrapper.html +++ b/cms/templates/studio_xblock_wrapper.html @@ -27,17 +27,13 @@ block_is_unit = is_unit(xblock) - +<%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}"]') + % if isinstance(xblock, (XModule, XModuleDescriptor)): <%static:webpack entry="${getattr(xblock.__class__, 'unmixed_class', xblock.__class__).__name__}"/> diff --git a/lms/envs/bok_choy_docker.py b/lms/envs/bok_choy_docker.py index 96dd3902cc..cd09b6e95a 100644 --- a/lms/envs/bok_choy_docker.py +++ b/lms/envs/bok_choy_docker.py @@ -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) diff --git a/webpack.common.config.js b/webpack.common.config.js index d974bfdb49..a75a881781 100644 --- a/webpack.common.config.js +++ b/webpack.common.config.js @@ -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',