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