Commit 5d6bcbbe by Will Daly

Move JS server object into a common directory so it's shared with LMS and Studio

parent 3e3cef09
...@@ -17,8 +17,10 @@ module.exports = function(config) { ...@@ -17,8 +17,10 @@ module.exports = function(config) {
'lib/jquery.min.js', 'lib/jquery.min.js',
'lib/*.js', 'lib/*.js',
'src/oa_shared.js', 'src/oa_shared.js',
'src/*.js',
'src/lms/*.js', 'src/lms/*.js',
'src/studio/*.js', 'src/studio/*.js',
'spec/*.js',
'spec/lms/*.js', 'spec/lms/*.js',
'spec/studio/*.js', 'spec/studio/*.js',
...@@ -39,6 +41,7 @@ module.exports = function(config) { ...@@ -39,6 +41,7 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser // preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: { preprocessors: {
'src/*.js': 'coverage',
'src/lms/*.js': 'coverage', 'src/lms/*.js': 'coverage',
'src/studio/*.js': 'coverage' 'src/studio/*.js': 'coverage'
}, },
......
/** /**
Interface for server-side XBlock handlers. Encapsulate interactions with OpenAssessment XBlock handlers.
**/
// Since the server is included by both LMS and Studio views,
// skip loading it the second time.
if (typeof OpenAssessment.Server == "undefined" || !OpenAssessment.Server) {
/**
Interface for server-side XBlock handlers.
Args: Args:
runtime (Runtime): An XBlock runtime instance. runtime (Runtime): An XBlock runtime instance.
element (DOM element): The DOM element representing this XBlock. element (DOM element): The DOM element representing this XBlock.
Returns: Returns:
OpenAssessment.Server OpenAssessment.Server
**/ **/
OpenAssessment.Server = function(runtime, element) { OpenAssessment.Server = function(runtime, element) {
this.runtime = runtime; this.runtime = runtime;
this.element = element; this.element = element;
}; };
OpenAssessment.Server.prototype = { OpenAssessment.Server.prototype = {
/** /**
Construct the URL for the handler, specific to one instance of the XBlock on the page. Construct the URL for the handler, specific to one instance of the XBlock on the page.
...@@ -463,4 +471,5 @@ OpenAssessment.Server.prototype = { ...@@ -463,4 +471,5 @@ OpenAssessment.Server.prototype = {
}); });
}).promise(); }).promise();
} }
}; };
}
\ No newline at end of file
...@@ -19,5 +19,5 @@ if [[ -n "$DEBUG_JS" ]]; then ...@@ -19,5 +19,5 @@ if [[ -n "$DEBUG_JS" ]]; then
UGLIFY_EXTRA_ARGS="--beautify" UGLIFY_EXTRA_ARGS="--beautify"
fi fi
node_modules/.bin/uglifyjs $STATIC_JS/src/oa_shared.js $STATIC_JS/src/lms/*.js $UGLIFY_EXTRA_ARGS > "$STATIC_JS/openassessment-lms.min.js" node_modules/.bin/uglifyjs $STATIC_JS/src/oa_shared.js $STATIC_JS/src/*.js $STATIC_JS/src/lms/*.js $UGLIFY_EXTRA_ARGS > "$STATIC_JS/openassessment-lms.min.js"
node_modules/.bin/uglifyjs $STATIC_JS/src/oa_shared.js $STATIC_JS/src/studio/*.js $UGLIFY_EXTRA_ARGS > "$STATIC_JS/openassessment-studio.min.js" node_modules/.bin/uglifyjs $STATIC_JS/src/oa_shared.js $STATIC_JS/src/*.js $STATIC_JS/src/studio/*.js $UGLIFY_EXTRA_ARGS > "$STATIC_JS/openassessment-studio.min.js"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment