##// END OF EJS Templates
handle_msg a display_model method.
Jonathan Frederic -
Show More
@@ -71,28 +71,24
71 };
71 };
72
72
73
73
74 WidgetManager.prototype.handle_msg = function(msg, model) {
74 WidgetManager.prototype.display_view = function(msg_id, model) {
75 var method = msg.content.data.method;
75 var cell = this.get_msg_cell(msg_id);
76 switch (method) {
76 if (cell === null) {
77 case 'display':
77 console.log("Could not determine where the display" +
78 var cell = this.get_msg_cell(msg.parent_header.msg_id);
78 " message was from. Widget will not be displayed");
79 if (cell === null) {
79 } else {
80 console.log("Could not determine where the display" +
80 var view = this.create_view(model);
81 " message was from. Widget will not be displayed");
81 if (view !== undefined
82 } else {
82 && cell.widget_subarea !== undefined
83 var view = this.create_view(model);
83 && cell.widget_subarea !== null) {
84 if (view !== undefined
84
85 && cell.widget_subarea !== undefined
85 view.cell = cell;
86 && cell.widget_subarea !== null) {
86 cell.widget_area.show();
87
87 cell.widget_subarea.append(view.$el);
88 view.cell = cell;
88 }
89 cell.widget_area.show();
90 cell.widget_subarea.append(view.$el);
91 }
92 }
93 break;
94 }
89 }
95 }
90 },
91
96
92
97 <<<<<<< HEAD
93 <<<<<<< HEAD
98 <<<<<<< HEAD
94 <<<<<<< HEAD
@@ -174,6 +170,7
174 }
170 }
175 },
171 },
176
172
173
177 WidgetManager.prototype.get_msg_cell = function (msg_id) {
174 WidgetManager.prototype.get_msg_cell = function (msg_id) {
178 var cell = null;
175 var cell = null;
179 // First, check to see if the msg was triggered by cell execution.
176 // First, check to see if the msg was triggered by cell execution.
@@ -70,9 +70,9 function(widget_manager, underscore, backbone){
70 case 'custom':
70 case 'custom':
71 this.trigger('msg:custom', msg.content.data.custom_content);
71 this.trigger('msg:custom', msg.content.data.custom_content);
72 break;
72 break;
73 default:
73 case 'display':
74 // pass on to widget manager
74 this.widget_manager.display_view(msg.parent_header.msg_id, this);
75 this.widget_manager.handle_msg(msg, this);
75 break;
76 }
76 }
77 },
77 },
78
78
General Comments 0
You need to be logged in to leave comments. Login now