diff --git a/IPython/html/services/notebooks/nbmanager.py b/IPython/html/services/notebooks/nbmanager.py index ed01f43..2bf219d 100644 --- a/IPython/html/services/notebooks/nbmanager.py +++ b/IPython/html/services/notebooks/nbmanager.py @@ -134,7 +134,7 @@ class NotebookManager(LoggingConfigurable): """Copy an existing notebook and return its new model.""" model = self.get_notebook_model(name, path) name = os.path.splitext(name)[0] + '-Copy' - name = self.increment_filename(name, path) + self.filename_ext + name = self.increment_filename(name, path) model['name'] = name model = self.save_notebook_model(model, name, path) return model diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index e7a2b40..9c3055d 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -1743,47 +1743,56 @@ var IPython = (function (IPython) { Notebook.prototype.new_notebook = function(){ var path = this.notebookPath(); + var base_project_url = this.baseProjectUrl(); var settings = { processData : false, cache : false, type : "POST", dataType : "json", - success:$.proxy(function (data, status, xhr){ + async : false, + success : function (data, status, xhr){ var notebook_name = data.name; window.open( utils.url_path_join( - this.baseProjectUrl(), + base_project_url, 'notebooks', - this.notebookPath(), + path, notebook_name ), '_blank' ); - }, this) + } }; - var url = this.baseProjectUrl() + 'api/notebooks' + path; + var url = utils.url_path_join( + base_project_url, + 'api/notebooks', + path + ); $.ajax(url,settings); }; Notebook.prototype.copy_notebook = function(){ var path = this.notebookPath(); + var base_project_url = this.baseProjectUrl(); var settings = { processData : false, cache : false, type : "POST", - success:$.proxy(function (data, status, xhr){ + dataType : "json", + async : false, + success : function (data, status, xhr) { var notebook_name = data.name; window.open(utils.url_path_join( - this._baseProjectUrl, + base_project_url, 'notebooks', - this.notebookPath(), + path, notebook_name - )); - }, this) + ), '_blank'); + } }; var url = utils.url_path_join( - this._baseProjectUrl, + base_project_url, 'api/notebooks', path, this.notebook_name, diff --git a/IPython/html/static/tree/js/notebooklist.js b/IPython/html/static/tree/js/notebooklist.js index 69957eb..3d67abe 100644 --- a/IPython/html/static/tree/js/notebooklist.js +++ b/IPython/html/static/tree/js/notebooklist.js @@ -364,25 +364,27 @@ var IPython = (function (IPython) { NotebookList.prototype.new_notebook = function(){ var path = this.notebookPath(); + var base_project_url = this.baseProjectUrl(); var settings = { processData : false, cache : false, type : "POST", dataType : "json", - success:$.proxy(function (data, status, xhr){ + async : false, + success : function (data, status, xhr) { var notebook_name = data.name; window.open( utils.url_path_join( - this.baseProjectUrl(), + base_project_url, 'notebooks', path, notebook_name), '_blank' ); - }, this) + } }; var url = utils.url_path_join( - this.baseProjectUrl(), + base_project_url, 'api/notebooks', path );