From 5717a3eb10be85713e050cfddec21324d0beda88 Mon Sep 17 00:00:00 2001 From: KesterTong Date: Sun, 13 Jul 2014 15:59:36 -0500 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. --- IPython/html/static/base/js/contentmanager.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/IPython/html/static/base/js/contentmanager.js b/IPython/html/static/base/js/contentmanager.js index adf734885..2972ef8a3 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,