Show More
@@ -90,10 +90,18 | |||||
90 | } |
|
90 | } | |
91 | }, |
|
91 | }, | |
92 |
|
92 | |||
93 | WidgetManager.prototype.create_view = function(model, options) { |
|
93 | WidgetManager.prototype.create_view = function(model, options, view) { | |
94 | var view_name = model.get('view_name'); |
|
94 | var view_name = model.get('view_name'); | |
95 | var ViewType = WidgetManager._view_types[view_name]; |
|
95 | var ViewType = WidgetManager._view_types[view_name]; | |
96 | if (ViewType !== undefined && ViewType !== null) { |
|
96 | if (ViewType !== undefined && ViewType !== null) { | |
|
97 | ||||
|
98 | // If a view is passed into the method, use that view's cell as | |||
|
99 | // the cell for the view that is created. | |||
|
100 | options = options || {}; | |||
|
101 | if (view !== undefined) { | |||
|
102 | options.cell = view.options.cell; | |||
|
103 | } | |||
|
104 | ||||
97 | var parameters = {model: model, options: options}; |
|
105 | var parameters = {model: model, options: options}; | |
98 | var view = new ViewType(parameters); |
|
106 | var view = new ViewType(parameters); | |
99 | view.render(); |
|
107 | view.render(); |
@@ -261,7 +261,7 function(WidgetManager, Underscore, Backbone){ | |||||
261 | // TODO: this is hacky, and makes the view depend on this cell attribute and widget manager behavior |
|
261 | // TODO: this is hacky, and makes the view depend on this cell attribute and widget manager behavior | |
262 | // it would be great to have the widget manager add the cell metadata |
|
262 | // it would be great to have the widget manager add the cell metadata | |
263 | // to the subview without having to add it here. |
|
263 | // to the subview without having to add it here. | |
264 | var child_view = this.model.widget_manager.create_view(child_model, options || {}); |
|
264 | var child_view = this.model.widget_manager.create_view(child_model, options || {}, this); | |
265 | this.child_views[child_model.id] = child_view; |
|
265 | this.child_views[child_model.id] = child_view; | |
266 | return child_view; |
|
266 | return child_view; | |
267 | }, |
|
267 | }, |
General Comments 0
You need to be logged in to leave comments.
Login now