Show More
@@ -2041,31 +2041,17 b' define([' | |||
|
2041 | 2041 | }; |
|
2042 | 2042 | |
|
2043 | 2043 | Notebook.prototype.copy_notebook = function(){ |
|
2044 | var path = this.notebook_path; | |
|
2045 | 2044 | var base_url = this.base_url; |
|
2046 | var settings = { | |
|
2047 | processData : false, | |
|
2048 |
|
|
|
2049 | type : "POST", | |
|
2050 | dataType : "json", | |
|
2051 | data : JSON.stringify({copy_from : this.notebook_name}), | |
|
2052 | async : false, | |
|
2053 | success : function (data, status, xhr) { | |
|
2045 | this.contents.copy_file(this.notebook_path, null, this.notebook_name, { | |
|
2046 | // synchronous so we can open a new window on success | |
|
2047 | extra_settings: {async: false}, | |
|
2048 | success: function (data) { | |
|
2054 | 2049 | window.open(utils.url_join_encode( |
|
2055 | base_url, | |
|
2056 | 'notebooks', | |
|
2057 | data.path, | |
|
2058 | data.name | |
|
2050 | base_url, 'notebooks', data.path, data.name | |
|
2059 | 2051 | ), '_blank'); |
|
2060 | 2052 | }, |
|
2061 |
error : utils.log_ajax_error |
|
|
2062 | }; | |
|
2063 | var url = utils.url_join_encode( | |
|
2064 | base_url, | |
|
2065 | 'api/contents', | |
|
2066 | path | |
|
2067 | ); | |
|
2068 | $.ajax(url,settings); | |
|
2053 | error : utils.log_ajax_error | |
|
2054 | }); | |
|
2069 | 2055 | }; |
|
2070 | 2056 | |
|
2071 | 2057 | Notebook.prototype.rename = function (new_name) { |
@@ -153,7 +153,6 b' define([' | |||
|
153 | 153 | // We do the call with settings so we can set cache to false. |
|
154 | 154 | var settings = { |
|
155 | 155 | processData : false, |
|
156 | cache : false, | |
|
157 | 156 | type : "PUT", |
|
158 | 157 | data : JSON.stringify(model), |
|
159 | 158 | contentType: 'application/json', |
@@ -166,6 +165,31 b' define([' | |||
|
166 | 165 | var url = this.api_url(path, name); |
|
167 | 166 | $.ajax(url, settings); |
|
168 | 167 | }; |
|
168 | ||
|
169 | Contents.prototype.copy_file = function(to_path, to_name, from, options) { | |
|
170 | var url, method; | |
|
171 | if (to_name) { | |
|
172 | url = this.api_url(to_path, to_name); | |
|
173 | method = "PUT"; | |
|
174 | } else { | |
|
175 | url = this.api_url(to_path); | |
|
176 | method = "POST"; | |
|
177 | } | |
|
178 | ||
|
179 | var settings = { | |
|
180 | processData : false, | |
|
181 | cache : false, | |
|
182 | type: method, | |
|
183 | data: JSON.stringify({copy_from: from}), | |
|
184 | dataType : "json", | |
|
185 | success: options.success || function() {}, | |
|
186 | error: this.create_basic_error_handler(options.error) | |
|
187 | }; | |
|
188 | if (options.extra_settings) { | |
|
189 | $.extend(settings, options.extra_settings); | |
|
190 | } | |
|
191 | $.ajax(url, settings); | |
|
192 | }; | |
|
169 | 193 | |
|
170 | 194 | /** |
|
171 | 195 | * Checkpointing Functions |
General Comments 0
You need to be logged in to leave comments.
Login now