Show More
@@ -35,7 +35,7 b' define(["components/underscore/underscore-min",' | |||
|
35 | 35 | this.pending_msgs = 0; |
|
36 | 36 | this.msg_throttle = 3; |
|
37 | 37 | this.msg_buffer = null; |
|
38 |
this.views = |
|
|
38 | this.views = []; | |
|
39 | 39 | this._custom_msg_callbacks = []; |
|
40 | 40 | |
|
41 | 41 | // Remember comm associated with the model. |
@@ -54,13 +54,10 b' define(["components/underscore/underscore-min",' | |||
|
54 | 54 | this.last_modified_view = caller; |
|
55 | 55 | this.save(this.changedAttributes(), {patch: true}); |
|
56 | 56 | |
|
57 |
for (var |
|
|
58 |
var view |
|
|
59 |
f |
|
|
60 | var view = views[view_index]; | |
|
61 | if (view !== caller) { | |
|
62 | view.update(); | |
|
63 | } | |
|
57 | for (var view_index in this.views) { | |
|
58 | var view = this.views[view_index]; | |
|
59 | if (view !== caller) { | |
|
60 | view.update(); | |
|
64 | 61 | } |
|
65 | 62 | } |
|
66 | 63 | }, |
@@ -290,16 +287,13 b' define(["components/underscore/underscore-min",' | |||
|
290 | 287 | args = [].splice.call(arguments,1); |
|
291 | 288 | } |
|
292 | 289 | |
|
293 |
for (var |
|
|
294 |
var view |
|
|
295 | for (var view_index in views) { | |
|
296 | var view = views[view_index]; | |
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
|
300 | } else { | |
|
301 | method.apply(view, args); | |
|
302 | } | |
|
290 | for (var view_index in this.views) { | |
|
291 | var view = this.views[view_index]; | |
|
292 | var method = view[method_name]; | |
|
293 | if (args === null) { | |
|
294 | method.apply(view); | |
|
295 | } else { | |
|
296 | method.apply(view, args); | |
|
303 | 297 | } |
|
304 | 298 | } |
|
305 | 299 | }, |
@@ -314,17 +308,19 b' define(["components/underscore/underscore-min",' | |||
|
314 | 308 | if (parent_comm_id != undefined) { |
|
315 | 309 | var parent_comm = this.comm_manager.comms[parent_comm_id]; |
|
316 | 310 | var parent_model = parent_comm.model; |
|
317 |
var parent_views = parent_model.views |
|
|
311 | var parent_views = parent_model.views; | |
|
318 | 312 | for (var parent_view_index in parent_views) { |
|
319 | 313 | var parent_view = parent_views[parent_view_index]; |
|
320 |
if (parent_view. |
|
|
321 | var view = this._create_view(view_name, cell); | |
|
322 | if (view != null) { | |
|
323 |
|
|
|
324 |
|
|
|
325 |
display |
|
|
326 |
|
|
|
327 | } | |
|
314 | if (parent_view.cell === cell) { | |
|
315 | if (parent_view.display_child != undefined) { | |
|
316 | var view = this._create_view(view_name, cell); | |
|
317 | if (view != null) { | |
|
318 | new_views.push(view); | |
|
319 | parent_view.display_child(view); | |
|
320 | displayed = true; | |
|
321 | this._handle_view_displayed(view); | |
|
322 | } | |
|
323 | } | |
|
328 | 324 | } |
|
329 | 325 | } |
|
330 | 326 | } |
@@ -358,23 +354,17 b' define(["components/underscore/underscore-min",' | |||
|
358 | 354 | if (view_type != undefined && view_type != null) { |
|
359 | 355 | var view = new view_type({model: this}); |
|
360 | 356 | view.render(); |
|
361 |
|
|
|
362 | this.views[cell] = [] | |
|
363 | } | |
|
364 | this.views[cell].push(view); | |
|
357 | this.views.push(view); | |
|
365 | 358 | view.cell = cell; |
|
366 | 359 | |
|
367 | 360 | // Handle when the view element is remove from the page. |
|
368 | 361 | var that = this; |
|
369 | 362 | view.$el.on("remove", function(){ |
|
370 |
var index = that.views |
|
|
363 | var index = that.views.indexOf(view); | |
|
371 | 364 | if (index > -1) { |
|
372 |
that.views |
|
|
365 | that.views.splice(index, 1); | |
|
373 | 366 | } |
|
374 | 367 | view.remove(); // Clean-up view |
|
375 | if (that.views[cell].length()==0) { | |
|
376 | delete that.views[cell]; | |
|
377 | } | |
|
378 | 368 | |
|
379 | 369 | // Close the comm if there are no views left. |
|
380 | 370 | if (that.views.length()==0) { |
General Comments 0
You need to be logged in to leave comments.
Login now