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