##// END OF EJS Templates
Fix the cell reference in views...
Jason Grout -
Show More
@@ -78,12 +78,11
78 console.log("Could not determine where the display" +
78 console.log("Could not determine where the display" +
79 " message was from. Widget will not be displayed");
79 " message was from. Widget will not be displayed");
80 } else {
80 } else {
81 var view = this.create_view(model);
81 var view = this.create_view(model, {cell: cell});
82 if (view !== undefined
82 if (view !== undefined
83 && cell.widget_subarea !== undefined
83 && cell.widget_subarea !== undefined
84 && cell.widget_subarea !== null) {
84 && cell.widget_subarea !== null) {
85
85
86 view.cell = cell;
87 cell.widget_area.show();
86 cell.widget_area.show();
88 cell.widget_subarea.append(view.$el);
87 cell.widget_subarea.append(view.$el);
89 }
88 }
@@ -141,7 +140,7
141 WidgetManager.prototype.callbacks = function (view) {
140 WidgetManager.prototype.callbacks = function (view) {
142 // callback handlers specific a view
141 // callback handlers specific a view
143 var callbacks = {};
142 var callbacks = {};
144 var cell = view.cell;
143 var cell = view.options.cell;
145 if (cell !== null) {
144 if (cell !== null) {
146 // Try to get output handlers
145 // Try to get output handlers
147 var handle_output = null;
146 var handle_output = null;
@@ -226,8 +226,14 function(widget_manager, underscore, backbone){
226 create_child_view: function(child_model, options) {
226 create_child_view: function(child_model, options) {
227 // Create and return a child view.
227 // Create and return a child view.
228 //
228 //
229 // - given a model and (optionally) a view name if the view name is
229 // -given a model and (optionally) a view name if the view name is
230 // not given, it defaults to the model's default view attribute.
230 // not given, it defaults to the model's default view attribute.
231
232 // TODO: this is hacky, and makes the view depend on this cell attribute and widget manager behavior
233 // it would be great to have the widget manager add the cell metadata
234 // to the subview without having to add it here.
235 options = options || {};
236 options.cell = this.options.cell;
231 var child_view = this.model.widget_manager.create_view(child_model, options);
237 var child_view = this.model.widget_manager.create_view(child_model, options);
232 this.child_views[child_model.id] = child_view;
238 this.child_views[child_model.id] = child_view;
233 return child_view;
239 return child_view;
General Comments 0
You need to be logged in to leave comments. Login now