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