More requirejs fixes

This commit is contained in:
Jonathan Frederic 2014-07-02 22:57:27 -07:00
parent ee76005bc2
commit 2478fac032
8 changed files with 22 additions and 11 deletions

View File

@ -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

View File

@ -132,4 +132,5 @@ require([
IPython.keyboard_manager = keyboard_manager;
IPython.save_widget = save_widget;
IPython.config = user_config;
IPython.tooltip = notebook.tooltip;
});

View File

@ -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);

View File

@ -3,7 +3,7 @@
define([
'base/js/namespace',
'jquery',
'jqueryui',
'base/js/utils',
'base/js/security',
'base/js/keyboard',

View File

@ -3,7 +3,7 @@
define([
'base/js/namespace',
'jquery',
'jqueryui',
'base/js/utils',
], function(IPython, $, utils) {
"use strict";

View File

@ -3,7 +3,8 @@
define([
"widgets/js/widget",
], function(widget){
"jqueryui"
], function(widget, $){
var ContainerView = widget.DOMWidgetView.extend({
render: function(){

View File

@ -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: "$"
}
}
});

View File

@ -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;