Show More
@@ -22,7 +22,13 b' define([' | |||||
22 | this.events = options.events; |
|
22 | this.events = options.events; | |
23 | this.base_url = options.base_url; |
|
23 | this.base_url = options.base_url; | |
24 | }; |
|
24 | }; | |
25 |
|
25 | |||
|
26 | Contents.prototype.api_url = function() { | |||
|
27 | var url_parts = [this.base_url, 'api/contents'].concat( | |||
|
28 | Array.prototype.slice.apply(arguments)); | |||
|
29 | return utils.url_join_encode.apply(null, url_parts); | |||
|
30 | }; | |||
|
31 | ||||
26 | /** |
|
32 | /** | |
27 | * Notebook Functions |
|
33 | * Notebook Functions | |
28 | */ |
|
34 | */ | |
@@ -51,12 +57,7 b' define([' | |||||
51 | error : error_callback, |
|
57 | error : error_callback, | |
52 | }; |
|
58 | }; | |
53 | this.events.trigger('notebook_loading.Notebook'); |
|
59 | this.events.trigger('notebook_loading.Notebook'); | |
54 |
var url = |
|
60 | var url = this.api_url(path, name); | |
55 | this.base_url, |
|
|||
56 | 'api/contents', |
|
|||
57 | path, |
|
|||
58 | name |
|
|||
59 | ); |
|
|||
60 | $.ajax(url, settings); |
|
61 | $.ajax(url, settings); | |
61 | }; |
|
62 | }; | |
62 |
|
63 | |||
@@ -84,12 +85,7 b' define([' | |||||
84 | error_callback(xhr, status, error); |
|
85 | error_callback(xhr, status, error); | |
85 | } |
|
86 | } | |
86 | }; |
|
87 | }; | |
87 | var url = utils.url_join_encode( |
|
88 | $.ajax(this.api_url(path), settings); | |
88 | base_url, |
|
|||
89 | 'api/contents', |
|
|||
90 | path |
|
|||
91 | ); |
|
|||
92 | $.ajax(url,settings); |
|
|||
93 | }; |
|
89 | }; | |
94 |
|
90 | |||
95 | Contents.prototype.delete_notebook = function(name, path) { |
|
91 | Contents.prototype.delete_notebook = function(name, path) { | |
@@ -106,12 +102,7 b' define([' | |||||
106 | }), |
|
102 | }), | |
107 | error : utils.log_ajax_error |
|
103 | error : utils.log_ajax_error | |
108 | }; |
|
104 | }; | |
109 |
var url = |
|
105 | var url = this.api_url(path, name); | |
110 | this.base_url, |
|
|||
111 | 'api/contents', |
|
|||
112 | path, |
|
|||
113 | name |
|
|||
114 | ); |
|
|||
115 | $.ajax(url, settings); |
|
106 | $.ajax(url, settings); | |
116 | }; |
|
107 | }; | |
117 |
|
108 | |||
@@ -134,12 +125,7 b' define([' | |||||
134 | [xhr, status, error]); |
|
125 | [xhr, status, error]); | |
135 | } |
|
126 | } | |
136 | }; |
|
127 | }; | |
137 |
var url = |
|
128 | var url = this.api_url(path, name); | |
138 | this.base_url, |
|
|||
139 | 'api/contents', |
|
|||
140 | path, |
|
|||
141 | name |
|
|||
142 | ); |
|
|||
143 | $.ajax(url, settings); |
|
129 | $.ajax(url, settings); | |
144 | }; |
|
130 | }; | |
145 |
|
131 | |||
@@ -175,12 +161,7 b' define([' | |||||
175 | settings[key] = extra_settings[key]; |
|
161 | settings[key] = extra_settings[key]; | |
176 | } |
|
162 | } | |
177 | } |
|
163 | } | |
178 |
var url = |
|
164 | var url = this.api_url(path, name); | |
179 | this.base_url, |
|
|||
180 | 'api/contents', |
|
|||
181 | path, |
|
|||
182 | name |
|
|||
183 | ); |
|
|||
184 | $.ajax(url, settings); |
|
165 | $.ajax(url, settings); | |
185 | }; |
|
166 | }; | |
186 |
|
167 | |||
@@ -195,9 +176,7 b' define([' | |||||
195 | Contents.prototype.restore_checkpoint = function(notebook, id) { |
|
176 | Contents.prototype.restore_checkpoint = function(notebook, id) { | |
196 | that = notebook; |
|
177 | that = notebook; | |
197 | this.events.trigger('notebook_restoring.Notebook', checkpoint); |
|
178 | this.events.trigger('notebook_restoring.Notebook', checkpoint); | |
198 |
var url = |
|
179 | var url = this.api_url( | |
199 | this.base_url, |
|
|||
200 | 'api/contents', |
|
|||
201 | this.notebook_path, |
|
180 | this.notebook_path, | |
202 | this.notebook_name, |
|
181 | this.notebook_name, | |
203 | 'checkpoints', |
|
182 | 'checkpoints', | |
@@ -212,9 +191,7 b' define([' | |||||
212 |
|
191 | |||
213 | Contents.prototype.list_checkpoints = function(notebook) { |
|
192 | Contents.prototype.list_checkpoints = function(notebook) { | |
214 | that = notebook; |
|
193 | that = notebook; | |
215 |
var url = |
|
194 | var url = this.api_url( | |
216 | that.base_url, |
|
|||
217 | 'api/contents', |
|
|||
218 | that.notebook_path, |
|
195 | that.notebook_path, | |
219 | that.notebook_name, |
|
196 | that.notebook_name, | |
220 | 'checkpoints' |
|
197 | 'checkpoints' | |
@@ -258,9 +235,7 b' define([' | |||||
258 | error : error_callback |
|
235 | error : error_callback | |
259 | }; |
|
236 | }; | |
260 |
|
237 | |||
261 | var url = utils.url_join_encode(this.base_url, 'api', 'contents', |
|
238 | $.ajax(this.api_url(path), settings); | |
262 | path); |
|
|||
263 | $.ajax(url, settings); |
|
|||
264 | }; |
|
239 | }; | |
265 |
|
240 | |||
266 |
|
241 |
General Comments 0
You need to be logged in to leave comments.
Login now