Make display also pend on set_state.

Jonathan Frederic 12 years ago committed by Jonathan Frederic
parent a4331a93cc
commit b16b2e8749

@ -85,27 +85,27 @@ define([
}
};
WidgetManager.prototype.create_view = function(model, options) {
// Creates a promise for a view of a given model
return utils.load(model.get('_view_name'), model.get('_view_module'),
WidgetManager._view_types).then(function(ViewType) {
// If a view is passed into the method, use that view's cell as
// the cell for the view that is created.
options = options || {};
if (options.parent !== undefined) {
options.cell = options.parent.options.cell;
}
// Create and render the view...
var parameters = {model: model, options: options};
var view = new ViewType(parameters);
view.listenTo(model, 'destroy', view.remove);
view.render();
return view;
}, function(error) {
console.error(error);
return Promise.reject(error);
});
WidgetManager._view_types).then(function(ViewType) {
// If a view is passed into the method, use that view's cell as
// the cell for the view that is created.
options = options || {};
if (options.parent !== undefined) {
options.cell = options.parent.options.cell;
}
// Create and render the view...
var parameters = {model: model, options: options};
var view = new ViewType(parameters);
view.listenTo(model, 'destroy', view.remove);
view.render();
return view;
}, function(error) {
console.error(error);
return Promise.reject(error);
});
};
WidgetManager.prototype.get_msg_cell = function (msg_id) {

@ -80,7 +80,9 @@ define(["widgets/js/manager",
this.trigger('msg:custom', msg.content.data.content);
break;
case 'display':
this.widget_manager.display_view(msg, this);
this.state_change = this.state_change.then(function () {
that.widget_manager.display_view(msg, that);
});
break;
}
},

Loading…
Cancel
Save