From 73c6b2864af809dd5c97535b0ff8d21b7bed79c2 2014-07-10 20:47:23 From: Jonathan Frederic Date: 2014-07-10 20:47:23 Subject: [PATCH] More requirejs fixes --- diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js index f1932e7..3e762da 100644 --- a/IPython/html/static/notebook/js/codecell.js +++ b/IPython/html/static/notebook/js/codecell.js @@ -5,13 +5,12 @@ define([ 'base/js/namespace', 'jquery', 'base/js/utils', - 'notebook/js/tooltip', 'base/js/keyboard', 'notebook/js/cell', 'notebook/js/outputarea', 'notebook/js/completer', 'notebook/js/celltoolbar', -], function(IPython, $, utils, tooltip, keyboard, cell, outputarea, completer, celltoolbar) { +], function(IPython, $, utils, keyboard, cell, outputarea, completer, celltoolbar) { "use strict"; var Cell = cell.Cell; @@ -56,11 +55,12 @@ define([ // config: dictionary // keyboard_manager: KeyboardManager instance // notebook: Notebook instance + // tooltip: Tooltip instance this.kernel = kernel || null; this.notebook = options.notebook; this.collapsed = false; this.events = options.events; - this.tooltip = new tooltip.Tooltip(this.events); + this.tooltip = options.tooltip; this.config = options.config; // create all attributed in constructor function diff --git a/IPython/html/static/notebook/js/main.js b/IPython/html/static/notebook/js/main.js index cb5d136..b36dcfc 100644 --- a/IPython/html/static/notebook/js/main.js +++ b/IPython/html/static/notebook/js/main.js @@ -132,4 +132,5 @@ require([ IPython.keyboard_manager = keyboard_manager; IPython.save_widget = save_widget; IPython.config = user_config; + IPython.tooltip = notebook.tooltip; }); diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index bbdb229..feeddaf 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -13,6 +13,7 @@ define([ 'components/marked/lib/marked', 'notebook/js/mathjaxutils', 'base/js/keyboard', + 'notebook/js/tooltip', ], function ( IPython, $, @@ -24,7 +25,8 @@ define([ celltoolbar, marked, mathjaxutils, - keyboard + keyboard, + tooltip ) { var Notebook = function (selector, options) { @@ -50,6 +52,7 @@ define([ this.events = options.events; this.keyboard_manager = options.keyboard_manager; this.save_widget = options.save_widget; + this.tooltip = tooltip.Tooltip(this.events); // TODO: This code smells (and the other `= this` line a couple lines down) // We need a better way to deal with circular instance references. this.keyboard_manager.notebook = this; @@ -815,7 +818,8 @@ define([ events: this.events, config: this.config, keyboard_manager: this.keyboard_manager, - notebook: this + notebook: this, + tooltip: this.tooltip, }; if (type === 'code') { cell = new codecell.CodeCell(this.kernel, cell_options); diff --git a/IPython/html/static/notebook/js/outputarea.js b/IPython/html/static/notebook/js/outputarea.js index 2a4f208..65b9641 100644 --- a/IPython/html/static/notebook/js/outputarea.js +++ b/IPython/html/static/notebook/js/outputarea.js @@ -3,7 +3,7 @@ define([ 'base/js/namespace', - 'jquery', + 'jqueryui', 'base/js/utils', 'base/js/security', 'base/js/keyboard', diff --git a/IPython/html/static/notebook/js/pager.js b/IPython/html/static/notebook/js/pager.js index a8c0cc2..2c40f37 100644 --- a/IPython/html/static/notebook/js/pager.js +++ b/IPython/html/static/notebook/js/pager.js @@ -3,7 +3,7 @@ define([ 'base/js/namespace', - 'jquery', + 'jqueryui', 'base/js/utils', ], function(IPython, $, utils) { "use strict"; diff --git a/IPython/html/static/widgets/js/widget_container.js b/IPython/html/static/widgets/js/widget_container.js index 8d679f0..2e7d997 100644 --- a/IPython/html/static/widgets/js/widget_container.js +++ b/IPython/html/static/widgets/js/widget_container.js @@ -3,7 +3,8 @@ define([ "widgets/js/widget", -], function(widget){ + "jqueryui" +], function(widget, $){ var ContainerView = widget.DOMWidgetView.extend({ render: function(){ diff --git a/IPython/html/templates/page.html b/IPython/html/templates/page.html index 49763e7..512898f 100644 --- a/IPython/html/templates/page.html +++ b/IPython/html/templates/page.html @@ -25,6 +25,7 @@ jquery: 'components/jquery/jquery.min', bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min', dateformat: 'dateformat/date.format', + jqueryui: 'components/jquery-ui/ui/minified/jquery-ui.min', }, shim: { underscore: { @@ -39,6 +40,10 @@ }, dateformat: { exports: "dateFormat" + }, + jqueryui: { + deps: ["jquery"], + exports: "$" } } }); diff --git a/IPython/html/tests/notebook/save.js b/IPython/html/tests/notebook/save.js index affe054..30c670d 100644 --- a/IPython/html/tests/notebook/save.js +++ b/IPython/html/tests/notebook/save.js @@ -11,10 +11,10 @@ casper.notebook_test(function () { this.evaluate(function (nbname) { IPython.notebook.notebook_name = nbname; IPython._save_success = IPython._save_failed = false; - $([IPython.events]).on('notebook_saved.Notebook', function () { + IPython.events.on('notebook_saved.Notebook', function () { IPython._save_success = true; }); - $([IPython.events]).on('notebook_save_failed.Notebook', + IPython.events.on('notebook_save_failed.Notebook', function (event, xhr, status, error) { IPython._save_failed = "save failed with " + xhr.status + xhr.responseText; }); @@ -41,7 +41,7 @@ casper.notebook_test(function () { }); this.thenEvaluate(function(){ - $([IPython.events]).on('checkpoint_created.Notebook', function (evt, data) { + IPython.events.on('checkpoint_created.Notebook', function (evt, data) { IPython._checkpoint_created = true; }); IPython._checkpoint_created = false;