From b6982c1edb1cdc4ee9096cf4f371c9713516056e 2014-11-03 18:17:12
From: Jeff Hemmelgarn <jhemmelg@gmail.com>
Date: 2014-11-03 18:17:12
Subject: [PATCH] switch notebook.delete to use contentmanager

Make notebook.delete call contentmanager.delete_notebook

---

diff --git a/IPython/html/static/notebook/js/main.js b/IPython/html/static/notebook/js/main.js
index 18853fe..8eb84ea 100644
--- a/IPython/html/static/notebook/js/main.js
+++ b/IPython/html/static/notebook/js/main.js
@@ -72,15 +72,16 @@ require([
     var save_widget = new savewidget.SaveWidget('span#save_widget', {
         events: events, 
         keyboard_manager: keyboard_manager});
+    var content_manager = new contentmanager.ContentManager($.extend({
+        events: events},
+        common_options));
     var notebook = new notebook.Notebook('div#notebook', $.extend({
         events: events,
         keyboard_manager: keyboard_manager,
         save_widget: save_widget,
+        content_manager: content_manager,
         config: user_config},
         common_options));
-    var content_manager = new contentmanager.ContentManager($.extend({
-        events: events},
-        common_options));
     var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options);
     var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', {
         notebook: notebook, 
@@ -137,6 +138,7 @@ require([
     IPython.page = page;
     IPython.layout_manager = layout_manager;
     IPython.notebook = notebook;
+    IPython.content_manager = content_manager;
     IPython.pager = pager;
     IPython.quick_help = quick_help;
     IPython.login_widget = login_widget;
diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js
index 1c30966..f094d9b 100644
--- a/IPython/html/static/notebook/js/notebook.js
+++ b/IPython/html/static/notebook/js/notebook.js
@@ -61,6 +61,7 @@ define([
         this.notebook_name = options.notebook_name;
         this.events = options.events;
         this.keyboard_manager = options.keyboard_manager;
+        this.content_manager = options.content_manager;
         this.save_widget = options.save_widget;
         this.tooltip = new tooltip.Tooltip(this.events);
         this.ws_url = options.ws_url;
@@ -2120,21 +2121,7 @@ define([
     };
 
     Notebook.prototype.delete = function () {
-        var that = this;
-        var settings = {
-            processData : false,
-            cache : false,
-            type : "DELETE",
-            dataType: "json",
-            error : utils.log_ajax_error,
-        };
-        var url = utils.url_join_encode(
-            this.base_url,
-            'api/contents',
-            this.notebook_path,
-            this.notebook_name
-        );
-        $.ajax(url, settings);
+        this.content_manager.delete_notebook(this.notebook_name, this.notebook_path, this.base_url);
     };