From cf379aced415a341392396e05ba9fd5d357acdad 2014-11-03 18:17:11 From: KesterTong Date: 2014-11-03 18:17:11 Subject: [PATCH] Make ContentManager stateless Don't store notebook_path in ContentManager, because this sort of state (in addition to notebook_name) can change, and keeping track of this logic doesn't seem to be a part of the file management system. Instead, this logic can be left to the Notebook instance (and possible other places that manage it). This makes refactoring easier, and avoids having to replicate this logic in every implementation of ContentManager. --- diff --git a/IPython/html/static/base/js/contentmanager.js b/IPython/html/static/base/js/contentmanager.js index adf7348..2972ef8 100644 --- a/IPython/html/static/base/js/contentmanager.js +++ b/IPython/html/static/base/js/contentmanager.js @@ -16,15 +16,21 @@ define([ // Parameters: // options: dictionary // Dictionary of keyword arguments. - // notebook_path: string + // events: $(Events) instance // base_url: string this.version = 0.1; - this.notebook_path = options.notebook_path; + this.events = options.events; this.base_url = options.base_url; }; - ContentManager.prototype.new_notebook = function() { - var path = this.notebook_path; + /** + * Creates a new notebook file at the specified path, and + * opens that notebook in a new window. + * + * @method scroll_to_cell + * @param {String} path The path to create the new notebook at + */ + ContentManager.prototype.new_notebook = function(path) { var base_url = this.base_url; var settings = { processData : false,