From 1d84d839f34773ec9f00c0245141dfcdf193993e Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Thu, 25 Jan 2018 09:57:59 +0100 Subject: [PATCH] Change the path to create notebooks in when navigating directories Closes gh-3263 Closes gh-3248 --- notebook/static/tree/js/newnotebook.js | 4 ++-- notebook/static/tree/js/notebooklist.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/notebook/static/tree/js/newnotebook.js b/notebook/static/tree/js/newnotebook.js index 9560cfee5..32445c58d 100644 --- a/notebook/static/tree/js/newnotebook.js +++ b/notebook/static/tree/js/newnotebook.js @@ -13,7 +13,6 @@ define([ var NewNotebookWidget = function (selector, options) { this.selector = selector; this.base_url = options.base_url; - this.notebook_path = options.notebook_path; this.contents = options.contents; this.events = options.events; this.default_kernel = null; @@ -79,7 +78,8 @@ define([ var that = this; kernel_name = kernel_name || this.default_kernel; var w = window.open(undefined, IPython._target); - this.contents.new_untitled(that.notebook_path, {type: "notebook"}).then( + var dir_path = $('body').attr('data-notebook-path'); + this.contents.new_untitled(dir_path, {type: "notebook"}).then( function (data) { var url = utils.url_path_join( that.base_url, 'notebooks', diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index c83efefcb..1abadbf86 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -399,6 +399,7 @@ define([ NotebookList.prototype.update_location = function (path) { this.notebook_path = path; + $('body').attr('data-notebook-path', path); // Update the file tree list without reloading the page this.load_list(); };