Merge pull request #3463 from aboudreault/xblock-initialization-issue

XBlocks are something initialized before all resources (url) are loaded
This commit is contained in:
Andy Armstrong
2014-04-25 13:09:49 -04:00

View File

@@ -25,18 +25,23 @@ define(["jquery", "underscore", "js/views/baseview", "xblock/runtime.v1"],
},
handleXBlockFragment: function(fragment, options) {
var wrapper = this.$el,
var self = this,
wrapper = this.$el,
xblockElement,
success = options ? options.success : null,
xblock;
this.renderXBlockFragment(fragment, wrapper);
xblockElement = this.$('.xblock').first();
xblock = XBlock.initializeBlock(xblockElement);
this.xblock = xblock;
this.xblockReady(xblock);
if (success) {
success(xblock);
}
xblock,
fragmentsRendered;
fragmentsRendered = this.renderXBlockFragment(fragment, wrapper);
fragmentsRendered.done(function() {
xblockElement = self.$('.xblock').first();
xblock = XBlock.initializeBlock(xblockElement);
self.xblock = xblock;
self.xblockReady(xblock);
if (success) {
success(xblock);
}
});
},
/**