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:
@@ -331,7 +331,8 @@ define(["jquery", "underscore", "gettext", "js/views/pages/base_page", "common/j
|
||||
success: function() {
|
||||
self.onXBlockRefresh(temporaryView, block_added, is_duplicate);
|
||||
temporaryView.unbind(); // Remove the temporary view
|
||||
}
|
||||
},
|
||||
initRuntimeData: this
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -30,6 +30,13 @@ define(["jquery", "underscore", "common/js/components/utils/view_utils", "js/vie
|
||||
});
|
||||
},
|
||||
|
||||
initRuntimeData: function(xblock, options) {
|
||||
if (options && options.initRuntimeData && xblock && xblock.runtime && !xblock.runtime.page) {
|
||||
xblock.runtime.page = options.initRuntimeData;
|
||||
}
|
||||
return xblock;
|
||||
},
|
||||
|
||||
handleXBlockFragment: function(fragment, options) {
|
||||
var self = this,
|
||||
wrapper = this.$el,
|
||||
@@ -44,8 +51,14 @@ define(["jquery", "underscore", "common/js/components/utils/view_utils", "js/vie
|
||||
xblockElement = self.$('.xblock').first();
|
||||
try {
|
||||
xblock = XBlock.initializeBlock(xblockElement);
|
||||
self.xblock = xblock;
|
||||
self.xblockReady(xblock);
|
||||
self.xblock = self.initRuntimeData(xblock, options);
|
||||
self.xblockReady(self.xblock);
|
||||
self.$('.xblock_asides-v1').each(function() {
|
||||
if (!$(this).hasClass('xblock-initialized')) {
|
||||
var aside = XBlock.initializeBlock($(this));
|
||||
self.initRuntimeData(aside, options);
|
||||
}
|
||||
});
|
||||
if (successCallback) {
|
||||
successCallback(xblock);
|
||||
}
|
||||
@@ -76,6 +89,15 @@ define(["jquery", "underscore", "common/js/components/utils/view_utils", "js/vie
|
||||
var runtime = this.xblock && this.xblock.runtime;
|
||||
if (runtime) {
|
||||
runtime.notify(eventName, data);
|
||||
} else if (this.xblock) {
|
||||
var xblock_children = this.xblock.element && $(this.xblock.element).prop('xblock_children');
|
||||
if (xblock_children) {
|
||||
$(xblock_children).each(function () {
|
||||
if (this.runtime) {
|
||||
this.runtime.notify(eventName, data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user