Revert "Revert "refactor: move xmodule folder to root""
This commit is contained in:
committed by
GitHub
parent
46d848be41
commit
a389a9ff10
@@ -0,0 +1,32 @@
|
||||
/* JavaScript for editing operations that can be done on the split test author view. */
|
||||
window.SplitTestAuthorView = function(runtime, element) {
|
||||
'use strict';
|
||||
var $element = $(element);
|
||||
var splitTestLocator = $element.closest('.studio-xblock-wrapper').data('locator');
|
||||
|
||||
runtime.listenTo('add-missing-groups', function(parentLocator) {
|
||||
if (splitTestLocator === parentLocator) {
|
||||
runtime.notify('save', {
|
||||
state: 'start',
|
||||
element: element,
|
||||
message: gettext('Creating missing groups')
|
||||
});
|
||||
$.post(runtime.handlerUrl(element, 'add_missing_groups')).done(function() {
|
||||
runtime.notify('save', {
|
||||
state: 'end',
|
||||
element: element
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Listen to delete events so that the view can refresh when the last inactive group is removed.
|
||||
runtime.listenTo('deleted-child', function(parentLocator) {
|
||||
var inactiveGroups = $element.find('.is-inactive .studio-xblock-wrapper');
|
||||
if (splitTestLocator === parentLocator && inactiveGroups.length === 0) {
|
||||
runtime.refreshXBlock($element);
|
||||
}
|
||||
});
|
||||
|
||||
return {};
|
||||
};
|
||||
31
xmodule/assets/split_test/public/js/split_test_staff.js
Normal file
31
xmodule/assets/split_test/public/js/split_test_staff.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/* Creates a new selector for managing toggling which child to show. */
|
||||
window.ABTestSelector = function(runtime, elem) {
|
||||
'use strict';
|
||||
var _this = {};
|
||||
_this.elem = $(elem);
|
||||
_this.children = _this.elem.find('.split-test-child');
|
||||
_this.content_container = _this.elem.find('.split-test-child-container');
|
||||
|
||||
function select_child(group_id) {
|
||||
// iterate over all the children and hide all the ones that haven't been selected
|
||||
// and show the one that was selected
|
||||
_this.children.each(function() {
|
||||
// force this id to remain a string, even if it looks like something else
|
||||
var child_group_id = $(this).data('group-id').toString();
|
||||
if (child_group_id === group_id) {
|
||||
_this.content_container.html(edx.HtmlUtils.HTML($(this).text()).toString());
|
||||
XBlock.initializeBlocks(_this.content_container, $(elem).data('request-token'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var select = _this.elem.find('.split-test-select');
|
||||
var cur_group_id = select.val();
|
||||
select_child(cur_group_id);
|
||||
|
||||
// bind the change event to the dropdown
|
||||
select.change(function() {
|
||||
var group_id = $(this).val();
|
||||
select_child(group_id);
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
/* Javascript for the Split Test XBlock. */
|
||||
window.SplitTestStudentView = function(runtime, element) {
|
||||
'use strict';
|
||||
$.post(runtime.handlerUrl(element, 'log_child_render'));
|
||||
return {};
|
||||
};
|
||||
Reference in New Issue
Block a user