Difficulty selectbox in Studio (based on new XBlockAside functionality). Include:
- adaptation asides to be imported from the XML - updating SplitMongo to handle XBlockAsides (CRUD operations) - updating Studio to handle XBlockAsides handler calls - updating xblock/core.js to properly init XBlockAsides JavaScript
This commit is contained in:
40
cms/static/js/xblock_asides/structured_tags.js
Normal file
40
cms/static/js/xblock_asides/structured_tags.js
Normal file
@@ -0,0 +1,40 @@
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
function StructuredTagsView(runtime, element) {
|
||||
|
||||
var $element = $(element);
|
||||
|
||||
$element.find("select").each(function() {
|
||||
var loader = this;
|
||||
var sts = $(this).attr('structured-tags-select-init');
|
||||
|
||||
if (typeof sts === typeof undefined || sts === false) {
|
||||
$(this).attr('structured-tags-select-init', 1);
|
||||
$(this).change(function(e) {
|
||||
e.preventDefault();
|
||||
var selectedKey = $(loader).find('option:selected').val();
|
||||
runtime.notify('save', {
|
||||
state: 'start',
|
||||
element: element,
|
||||
message: gettext('Updating Tags')
|
||||
});
|
||||
$.post(runtime.handlerUrl(element, 'save_tags'), {
|
||||
'tag': $(loader).attr('name') + ':' + selectedKey
|
||||
}).done(function() {
|
||||
runtime.notify('save', {
|
||||
state: 'end',
|
||||
element: element
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeStructuredTags(runtime, element) {
|
||||
return new StructuredTagsView(runtime, element);
|
||||
}
|
||||
|
||||
window.StructuredTagsInit = initializeStructuredTags;
|
||||
})($);
|
||||
Reference in New Issue
Block a user