Expose and use get requests specifying type in the JS

This commit is contained in:
Thomas Kluyver 2014-11-11 12:32:13 -08:00
parent ce6dd40c5c
commit f9db65ab6f
2 changed files with 7 additions and 12 deletions

View File

@ -2102,6 +2102,7 @@ define([
this.notebook_name = utils.url_path_split(this.notebook_path)[1];
this.events.trigger('notebook_loading.Notebook');
this.contents.get(notebook_path, {
type: 'notebook',
success: $.proxy(this.load_notebook_success, this),
error: $.proxy(this.load_notebook_error, this)
});

View File

@ -87,6 +87,9 @@ define([
error : this.create_basic_error_handler(options.error)
};
var url = this.api_url(path);
if (options.type) {
url += '?type=' + options.type;
}
$.ajax(url, settings);
};
@ -250,20 +253,11 @@ define([
* last_modified: last modified dat
* @method list_notebooks
* @param {String} path The path to list notebooks in
* @param {Function} load_callback called with list of notebooks on success
* @param {Function} error called with ajax results on error
* @param {Object} options including success and error callbacks
*/
Contents.prototype.list_contents = function(path, options) {
var settings = {
processData : false,
cache : false,
type : "GET",
dataType : "json",
success : options.success,
error : this.create_basic_error_handler(options.error)
};
$.ajax(this.api_url(path), settings);
options.type = 'directory';
this.get(path, options);
};