Show More
@@ -85,27 +85,27 define([ | |||
|
85 | 85 | } |
|
86 | 86 | }; |
|
87 | 87 | |
|
88 | ||
|
89 | 88 | WidgetManager.prototype.create_view = function(model, options) { |
|
90 | 89 | // Creates a promise for a view of a given model |
|
91 | 90 | return utils.load(model.get('_view_name'), model.get('_view_module'), |
|
92 |
|
|
|
93 | // If a view is passed into the method, use that view's cell as | |
|
94 | // the cell for the view that is created. | |
|
95 | options = options || {}; | |
|
96 | if (options.parent !== undefined) { | |
|
97 | options.cell = options.parent.options.cell; | |
|
98 | } | |
|
99 | // Create and render the view... | |
|
100 | var parameters = {model: model, options: options}; | |
|
101 | var view = new ViewType(parameters); | |
|
102 | view.listenTo(model, 'destroy', view.remove); | |
|
103 | view.render(); | |
|
104 | return view; | |
|
105 | }, function(error) { | |
|
106 | console.error(error); | |
|
107 | return Promise.reject(error); | |
|
108 | }); | |
|
91 | WidgetManager._view_types).then(function(ViewType) { | |
|
92 | ||
|
93 | // If a view is passed into the method, use that view's cell as | |
|
94 | // the cell for the view that is created. | |
|
95 | options = options || {}; | |
|
96 | if (options.parent !== undefined) { | |
|
97 | options.cell = options.parent.options.cell; | |
|
98 | } | |
|
99 | // Create and render the view... | |
|
100 | var parameters = {model: model, options: options}; | |
|
101 | var view = new ViewType(parameters); | |
|
102 | view.listenTo(model, 'destroy', view.remove); | |
|
103 | view.render(); | |
|
104 | return view; | |
|
105 | }, function(error) { | |
|
106 | console.error(error); | |
|
107 | return Promise.reject(error); | |
|
108 | }); | |
|
109 | 109 | }; |
|
110 | 110 | |
|
111 | 111 | WidgetManager.prototype.get_msg_cell = function (msg_id) { |
@@ -80,7 +80,9 define(["widgets/js/manager", | |||
|
80 | 80 | this.trigger('msg:custom', msg.content.data.content); |
|
81 | 81 | break; |
|
82 | 82 | case 'display': |
|
83 | this.widget_manager.display_view(msg, this); | |
|
83 | this.state_change = this.state_change.then(function () { | |
|
84 | that.widget_manager.display_view(msg, that); | |
|
85 | }); | |
|
84 | 86 | break; |
|
85 | 87 | } |
|
86 | 88 | }, |
General Comments 0
You need to be logged in to leave comments.
Login now