mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Open window before creating new notebook
Avoids the need for synchronous requests.
This commit is contained in:
parent
28cc4e9c84
commit
260ebcebcf
@ -88,19 +88,19 @@ define([
|
||||
// File
|
||||
var that = this;
|
||||
this.element.find('#new_notebook').click(function () {
|
||||
var w = window.open();
|
||||
// Create a new notebook in the same path as the current
|
||||
// notebook's path.
|
||||
var parent = utils.url_path_split(that.notebook.notebook_path)[0];
|
||||
that.contents.new_untitled(parent, {
|
||||
type: "notebook",
|
||||
extra_settings: {async: false}, // So we can open a new window afterwards
|
||||
success: function (data) {
|
||||
window.open(
|
||||
utils.url_join_encode(
|
||||
w.location = utils.url_join_encode(
|
||||
that.base_url, 'notebooks', data.path
|
||||
), '_blank');
|
||||
);
|
||||
},
|
||||
error: function(error) {
|
||||
w.close();
|
||||
dialog.modal({
|
||||
title : 'Creating Notebook Failed',
|
||||
body : "The error was: " + error.message,
|
||||
|
@ -64,17 +64,16 @@ require([
|
||||
var login_widget = new loginwidget.LoginWidget('#login_widget', common_options);
|
||||
|
||||
$('#new_notebook').click(function (e) {
|
||||
var w = window.open();
|
||||
contents.new_untitled(common_options.notebook_path, {
|
||||
type: "notebook",
|
||||
extra_settings: {async: false}, // So we can open a new window afterwards
|
||||
success: function (data) {
|
||||
window.open(
|
||||
utils.url_join_encode(
|
||||
common_options.base_url, 'notebooks',
|
||||
data.path
|
||||
), '_blank');
|
||||
w.location = utils.url_join_encode(
|
||||
common_options.base_url, 'notebooks', data.path
|
||||
);
|
||||
},
|
||||
error: function(error) {
|
||||
w.close();
|
||||
dialog.modal({
|
||||
title : 'Creating Notebook Failed',
|
||||
body : "The error was: " + error.message,
|
||||
|
Loading…
Reference in New Issue
Block a user