Commit 230c0b5b by Andy Armstrong

Add more improvements from the review.

parent b23f17db
...@@ -75,7 +75,10 @@ define(["jquery", "underscore", "js/views/baseview", "js/views/xblock", "js/view ...@@ -75,7 +75,10 @@ define(["jquery", "underscore", "js/views/baseview", "js/views/xblock", "js/view
refreshXBlock: function(xblockInfo, xblockElement) { refreshXBlock: function(xblockInfo, xblockElement) {
var self = this, var self = this,
temporaryView; temporaryView;
// Create a temporary view to render the updated XBlock into // There is only one Backbone view created on the container page, which is
// for the container xblock itself. Any child xblocks rendered inside the
// container do not get a Backbone view. Thus, create a temporary XBlock
// around the child element so that it can be refreshed.
temporaryView = new XBlockView({ temporaryView = new XBlockView({
el: xblockElement, el: xblockElement,
model: xblockInfo, model: xblockInfo,
......
...@@ -106,14 +106,11 @@ define(["jquery", "underscore", "gettext", "js/views/feedback_notification", "js ...@@ -106,14 +106,11 @@ define(["jquery", "underscore", "gettext", "js/views/feedback_notification", "js
getXBlockData: function() { getXBlockData: function() {
var xblock = this.xblock, var xblock = this.xblock,
metadataEditor = this.getMetadataEditor(), metadataEditor = this.getMetadataEditor(),
metadata,
data; data;
data = xblock.save(); data = xblock.save();
metadata = data.metadata;
if (metadataEditor) { if (metadataEditor) {
metadata = _.extend(metadata || {}, this.getChangedMetadata()); data.metadata = _.extend(data.metadata || {}, this.getChangedMetadata());
} }
data.metadata = metadata;
return data; return data;
}, },
......
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