Show More
@@ -89,8 +89,8 b' define([' | |||
|
89 | 89 | this.element.find('#new_notebook').click(function () { |
|
90 | 90 | // Create a new notebook in the same path as the current |
|
91 | 91 | // notebook's path. |
|
92 |
that.contents.new |
|
|
93 |
|
|
|
92 | that.contents.new(that.notebook.notebook_path, null, { | |
|
93 | ext: ".ipynb", | |
|
94 | 94 | success: function (data) { |
|
95 | 95 | window.open( |
|
96 | 96 | utils.url_join_encode( |
@@ -97,12 +97,23 b' define([' | |||
|
97 | 97 | * |
|
98 | 98 | * @method scroll_to_cell |
|
99 | 99 | * @param {String} path The path to create the new notebook at |
|
100 | * @param {String} name Name for new file. Chosen by server if unspecified. | |
|
101 | * @param {Object} options: | |
|
102 | * ext: file extension to use if name unspecified | |
|
100 | 103 | */ |
|
101 |
Contents.prototype.new |
|
|
102 | var error = options.error || function() {}; | |
|
104 | Contents.prototype.new = function(path, name, options) { | |
|
105 | var method, data; | |
|
106 | if (name) { | |
|
107 | method = "PUT"; | |
|
108 | } else { | |
|
109 | method = "POST"; | |
|
110 | data = JSON.stringify({ext: options.ext || ".ipynb"}); | |
|
111 | } | |
|
112 | ||
|
103 | 113 | var settings = { |
|
104 | 114 | processData : false, |
|
105 |
type : |
|
|
115 | type : method, | |
|
116 | data: data, | |
|
106 | 117 | dataType : "json", |
|
107 | 118 | success : options.success || function() {}, |
|
108 | 119 | error : this.create_basic_error_handler(options.error) |
@@ -60,8 +60,8 b' require([' | |||
|
60 | 60 | login_widget = new loginwidget.LoginWidget('#login_widget', common_options); |
|
61 | 61 | |
|
62 | 62 | $('#new_notebook').click(function (e) { |
|
63 |
contents.new |
|
|
64 | { | |
|
63 | contents.new(common_options.notebook_path, null, { | |
|
64 | ext: ".ipynb", | |
|
65 | 65 | success: function (data) { |
|
66 | 66 | window.open( |
|
67 | 67 | utils.url_join_encode( |
General Comments 0
You need to be logged in to leave comments.
Login now