Commit 218d7513 by gradyward

Merge branch 'authoring' of https://github.com/edx/edx-ora2 into grady/assessment-reorder

Conflicts:
	openassessment/xblock/static/js/openassessment-lms.min.js
	openassessment/xblock/static/js/openassessment-studio.min.js
parents e26f6eff 78078148
...@@ -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'
}, },
......
...@@ -68,6 +68,11 @@ describe("OpenAssessment.EditSettingsView", function() { ...@@ -68,6 +68,11 @@ describe("OpenAssessment.EditSettingsView", function() {
}); });
it("builds a description of enabled assessments", function() { it("builds a description of enabled assessments", function() {
// In this test we also verify that the mechansim that reads off of the DOM is correct, in that it gets
// the right order of assessments, in addition to performing the correct calls. Note that this test's
// success depends on our Template having the original order (as it does in an unconfigured ORA problem)
// of TRAINING -> PEER -> SELF -> AI
// The Peer and Self Editor ID's // The Peer and Self Editor ID's
var peerID = "oa_peer_assessment_editor"; var peerID = "oa_peer_assessment_editor";
var selfID = "oa_self_assessment_editor"; var selfID = "oa_self_assessment_editor";
......
/** /**
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
...@@ -85,33 +85,38 @@ OpenAssessment.StudioView.prototype = { ...@@ -85,33 +85,38 @@ OpenAssessment.StudioView.prototype = {
Installs click listeners which initialize drag and drop functionality for assessment modules. Installs click listeners which initialize drag and drop functionality for assessment modules.
**/ **/
initializeSortableAssessments: function () { initializeSortableAssessments: function () {
var liveElement = this.liveElement; var view = this;
// Initialize Drag and Drop of Assessment Modules // Initialize Drag and Drop of Assessment Modules
$('#openassessment_assessment_module_settings_editors', liveElement).sortable({ $('#openassessment_assessment_module_settings_editors', view.element).sortable({
// On Start, we want to collapse all draggable items so that dragging is visually simple (no scrolling) // On Start, we want to collapse all draggable items so that dragging is visually simple (no scrolling)
start: function(event, ui) { start: function(event, ui) {
// Hide all of the contents (not the headers) of the divs, to collapse during dragging. // Hide all of the contents (not the headers) of the divs, to collapse during dragging.
$('.openassessment_assessment_module_editor', liveElement).hide(); $('.openassessment_assessment_module_editor', view.element).hide();
// Because of the way that JQuery actively resizes elements during dragging (directly setting
// the style property), the only way to over come it is to use an important tag ( :( ), or
// to tell JQuery to set the height to be Automatic (i.e. resize to the minimum nescesary size.)
// Because all of the information we don't want displayed is now hidden, an auto height will
// perform the apparent "collapse" that we are looking for in the Placeholder and Helper.
var targetHeight = 'auto'; var targetHeight = 'auto';
// Shrink the blank area behind the dragged item. // Shrink the blank area behind the dragged item.
ui.placeholder.height(targetHeight); ui.placeholder.height(targetHeight);
// Shrink the dragged item itself. // Shrink the dragged item itself.
ui.helper.height(targetHeight); ui.helper.height(targetHeight);
// Update the sortable // Update the sortable to reflect these changes.
$('#openassessment_assessment_module_settings_editors', liveElement) $('#openassessment_assessment_module_settings_editors', view.element)
.sortable('refresh').sortable('refreshPositions'); .sortable('refresh').sortable('refreshPositions');
}, },
// On stop, we redisplay the divs to their original state // On stop, we redisplay the divs to their original state
stop: function(event, ui){ stop: function(event, ui){
$('.openassessment_assessment_module_editor', liveElement).show(); $('.openassessment_assessment_module_editor', view.element).show();
}, },
snap: true, snap: true,
axis: "y", axis: "y",
handle: ".drag-handle", handle: ".drag-handle",
cursorAt: {top: 20} cursorAt: {top: 20}
}); });
$('#openassessment_assessment_module_settings_editors', liveElement).disableSelection(); $('#openassessment_assessment_module_settings_editors', view.element).disableSelection();
}, },
/** /**
......
...@@ -11,8 +11,7 @@ Returns: ...@@ -11,8 +11,7 @@ Returns:
**/ **/
OpenAssessment.EditSettingsView = function(element, assessmentViews) { OpenAssessment.EditSettingsView = function(element, assessmentViews) {
this.settingsElement = element; this.settingsElement = element;
this.assessmentsElement = $('#openassessment_assessment_module_settings_editors', this.assessmentsElement = $(element).siblings('#openassessment_assessment_module_settings_editors').get(0);
$(element).closest('#oa_settings_editor_wrapper'));
this.assessmentViews = assessmentViews; this.assessmentViews = assessmentViews;
}; };
......
...@@ -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