##// END OF EJS Templates
Some more event cleanup
Thomas Kluyver -
Show More
@@ -2132,6 +2132,7 b' define(['
2132 2132 Notebook.prototype.load_notebook = function (notebook_name, notebook_path) {
2133 2133 this.notebook_name = notebook_name;
2134 2134 this.notebook_path = notebook_path;
2135 this.events.trigger('notebook_loading.Notebook');
2135 2136 this.contents.load_file(notebook_path, notebook_name, {
2136 2137 success_callback: $.proxy(this.load_notebook_success, this),
2137 2138 error_callback: $.proxy(this.load_notebook_error, this)
@@ -17,9 +17,7 b' define(['
17 17 // Parameters:
18 18 // options: dictionary
19 19 // Dictionary of keyword arguments.
20 // events: $(Events) instance
21 20 // base_url: string
22 this.events = options.events;
23 21 this.base_url = options.base_url;
24 22 };
25 23
@@ -54,7 +52,6 b' define(['
54 52 success : options.success_callback,
55 53 error : options.error_callback || function() {}
56 54 };
57 this.events.trigger('notebook_loading.Notebook');
58 55 var url = this.api_url(path, name);
59 56 $.ajax(url, settings);
60 57 };
@@ -40,21 +40,6 b' define(['
40 40 this.session_list.events.on('sessions_loaded.Dashboard',
41 41 function(e, d) { that.sessions_loaded(d); });
42 42 }
43
44
45 if (this.contents && this.contents.events) {
46 this.contents.events.on('notebook_deleted.Contents',
47 function(e, d) {
48 // Remove the deleted notebook.
49 $( ":data(nbname)" ).each(function() {
50 var element = $( this );
51 if (element.data( "nbname" ) == d.name &&
52 element.data( "path" ) == d.path) {
53 element.remove();
54 }
55 });
56 });
57 }
58 43 };
59 44
60 45 NotebookList.prototype.style = function () {
@@ -348,9 +333,7 b' define(['
348 333 click: function() {
349 334 notebooklist.contents.delete_file(nbname, path, {
350 335 success_callback: function() {
351 that.events.trigger('notebook_deleted.Contents',
352 {name: name, path: path});
353 }
336 notebooklist.notebook_deleted(path, nbname);
354 337 });
355 338 }
356 339 },
@@ -362,6 +345,17 b' define(['
362 345 item.find(".item_buttons").text("").append(delete_button);
363 346 };
364 347
348 NotebookList.prototype.notebook_deleted = function(path, name) {
349 // Remove the deleted notebook.
350 $( ":data(nbname)" ).each(function() {
351 var element = $( this );
352 if (element.data( "nbname" ) == d.name &&
353 element.data( "path" ) == d.path) {
354 element.remove();
355 }
356 });
357 }
358
365 359
366 360 NotebookList.prototype.add_upload_button = function (item, type) {
367 361 var that = this;
General Comments 0
You need to be logged in to leave comments. Login now