Open window before creating new notebook

Avoids the need for synchronous requests.
This commit is contained in:
Thomas Kluyver 2014-11-04 11:08:00 -08:00
parent 28cc4e9c84
commit 260ebcebcf
2 changed files with 9 additions and 10 deletions

View File

@ -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,

View File

@ -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,