Moves load_notebook to ContentManager and adds new_notebook to Google Drive version

pull/37/head
KesterTong 12 years ago committed by Thomas Kluyver
parent e3ef5d3b70
commit 952ac7d0d8

@ -28,6 +28,40 @@ define([
* Notebook Functions
*/
/**
* Load a notebook.
*
* Calls success_callback with notebook JSON object (as string), or
* error_callback with error.
*
* @method load_notebook
* @param {String} path
* @param {String} name
* @param {Function} success_callback
* @param {Function} error_callback
*/
ContentManager.prototype.load_notebook = function (path, name, success_callback,
error_callback) {
// We do the call with settings so we can set cache to false.
var settings = {
processData : false,
cache : false,
type : "GET",
dataType : "json",
success : success_callback,
error : error_callback,
};
this.events.trigger('notebook_loading.Notebook');
var url = utils.url_join_encode(
this.base_url,
'api/notebooks',
path,
name
);
$.ajax(url, settings);
};
/**
* Creates a new notebook file at the specified path, and
* opens that notebook in a new window.

@ -2140,26 +2140,13 @@ define([
* @param {String} notebook_name and path A notebook to load
*/
Notebook.prototype.load_notebook = function (notebook_name, notebook_path) {
var that = this;
this.notebook_name = notebook_name;
this.notebook_path = notebook_path;
// We do the call with settings so we can set cache to false.
var settings = {
processData : false,
cache : false,
type : "GET",
dataType : "json",
success : $.proxy(this.load_notebook_success,this),
error : $.proxy(this.load_notebook_error,this),
};
this.events.trigger('notebook_loading.Notebook');
var url = utils.url_join_encode(
this.base_url,
'api/contents',
this.notebook_path,
this.notebook_name
);
$.ajax(url, settings);
this.content_manager.load_notebook(
notebook_path,
notebook_name,
$.proxy(this.load_notebook_success,this),
$.proxy(this.load_notebook_error,this));
};
/**

Loading…
Cancel
Save