Widget require.js fix

The WidgetManager namespace is passed around instead of a
widget_manager instance...
This commit is contained in:
Jonathan Frederic 2014-01-17 17:03:29 +00:00
parent c39050e642
commit e17200a533
11 changed files with 34 additions and 54 deletions

View File

@ -23,7 +23,7 @@
// elsewhere.
define(["underscore",
"backbone",
], function (underscore, backbone) {
], function (Underscore, Backbone) {
Backbone.sync = function (method, model, options) {
// Sync widget models to back-end.

View File

@ -17,7 +17,7 @@
define(["notebook/js/widgetmanager",
"underscore",
"backbone"],
function(widget_manager, underscore, backbone){
function(WidgetManager, Underscore, Backbone){
var WidgetModel = Backbone.Model.extend({
constructor: function (widget_manager, model_id, comm) {
@ -211,7 +211,7 @@ function(widget_manager, underscore, backbone){
},
});
widget_manager.register_widget_model('WidgetModel', WidgetModel);
WidgetManager.register_widget_model('WidgetModel', WidgetModel);
var WidgetView = Backbone.View.extend({
@ -387,6 +387,6 @@ function(widget_manager, underscore, backbone){
IPython.WidgetView = WidgetView;
IPython.DOMWidgetView = DOMWidgetView;
// Pass through widget_manager instance (probably not a good practice).
return widget_manager;
// Pass through WidgetManager namespace.
return WidgetManager;
});

View File

@ -14,7 +14,7 @@
* @namespace IPython
**/
define(["notebook/js/widgets/widget"], function(widget_manager){
define(["notebook/js/widgets/widget"], function(WidgetManager){
var CheckBoxView = IPython.DOMWidgetView.extend({
render : function(){
@ -67,7 +67,7 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
},
});
widget_manager.register_widget_view('CheckBoxView', CheckBoxView);
WidgetManager.register_widget_view('CheckBoxView', CheckBoxView);
var ToggleButtonView = IPython.DOMWidgetView.extend({
@ -121,5 +121,5 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.touch();
},
});
widget_manager.register_widget_view('ToggleButtonView', ToggleButtonView);
WidgetManager.register_widget_view('ToggleButtonView', ToggleButtonView);
});

View File

@ -14,7 +14,7 @@
* @namespace IPython
**/
define(["notebook/js/widgets/widget"], function(widget_manager){
define(["notebook/js/widgets/widget"], function(WidgetManager){
var ButtonView = IPython.DOMWidgetView.extend({
render : function(){
@ -58,5 +58,5 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.send({event: 'click'});
},
});
widget_manager.register_widget_view('ButtonView', ButtonView);
WidgetManager.register_widget_view('ButtonView', ButtonView);
});

View File

@ -14,7 +14,7 @@
* @namespace IPython
**/
define(["notebook/js/widgets/widget"], function(widget_manager) {
define(["notebook/js/widgets/widget"], function(WidgetManager) {
var ContainerView = IPython.DOMWidgetView.extend({
render: function(){
@ -57,7 +57,7 @@ define(["notebook/js/widgets/widget"], function(widget_manager) {
return ContainerView.__super__.update.apply(this);
},
});
widget_manager.register_widget_view('ContainerView', ContainerView);
WidgetManager.register_widget_view('ContainerView', ContainerView);
var ModalView = IPython.DOMWidgetView.extend({
@ -273,5 +273,5 @@ define(["notebook/js/widgets/widget"], function(widget_manager) {
}
},
});
widget_manager.register_widget_view('ModalView', ModalView);
WidgetManager.register_widget_view('ModalView', ModalView);
});

View File

@ -5,16 +5,6 @@
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// FloatWidget
//============================================================================
/**
* @module IPython
* @namespace IPython
**/
define(["notebook/js/widgets/widget"], function(widget_manager){
// The Views for this model are shared with the bounded float, and can be
// found in widget_float_range.js.
});
// This file is a place holder to maintain a one to one mapping of widget_*.py
// files and widget_*.js widget and test files. The Views for this model are
// shared with the bounded float, and can be found in widget_float_range.js.

View File

@ -14,7 +14,7 @@
* @namespace IPython
**/
define(["notebook/js/widgets/widget"], function(widget_manager){
define(["notebook/js/widgets/widget"], function(WidgetManager){
var ImageView = IPython.DOMWidgetView.extend({
render : function(){
@ -47,5 +47,5 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
return ImageView.__super__.update.apply(this);
},
});
widget_manager.register_widget_view('ImageView', ImageView);
WidgetManager.register_widget_view('ImageView', ImageView);
});

View File

@ -5,16 +5,6 @@
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// IntWidget
//============================================================================
/**
* @module IPython
* @namespace IPython
**/
define(["notebook/js/widgets/widget"], function(widget_manager){
// The Views for this model are shared with the bounded int, and can be
// found in widget_int_range.js.
});
// This file is a place holder to maintain a one to one mapping of widget_*.py
// files and widget_*.js widget and test files. The Views for this model are
// shared with the bounded int, and can be found in widget_int_range.js.

View File

@ -14,7 +14,7 @@
* @namespace IPython
**/
define(["notebook/js/widgets/widget"], function(widget_manager){
define(["notebook/js/widgets/widget"], function(WidgetManager){
var DropdownView = IPython.DOMWidgetView.extend({
render : function(){
@ -114,7 +114,7 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
},
});
widget_manager.register_widget_view('DropdownView', DropdownView);
WidgetManager.register_widget_view('DropdownView', DropdownView);
var RadioButtonsView = IPython.DOMWidgetView.extend({
@ -204,7 +204,7 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.touch();
},
});
widget_manager.register_widget_view('RadioButtonsView', RadioButtonsView);
WidgetManager.register_widget_view('RadioButtonsView', RadioButtonsView);
var ToggleButtonsView = IPython.DOMWidgetView.extend({
@ -289,7 +289,7 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.touch();
},
});
widget_manager.register_widget_view('ToggleButtonsView', ToggleButtonsView);
WidgetManager.register_widget_view('ToggleButtonsView', ToggleButtonsView);
var ListBoxView = IPython.DOMWidgetView.extend({
@ -371,5 +371,5 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.touch();
},
});
widget_manager.register_widget_view('ListBoxView', ListBoxView);
WidgetManager.register_widget_view('ListBoxView', ListBoxView);
});

View File

@ -14,7 +14,7 @@
* @namespace IPython
**/
define(["notebook/js/widgets/widget"], function(widget_manager){
define(["notebook/js/widgets/widget"], function(WidgetManager){
var AccordionView = IPython.DOMWidgetView.extend({
render: function(){
@ -129,7 +129,7 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
setTimeout(function(){ that.update(); }, 500);
},
});
widget_manager.register_widget_view('AccordionView', AccordionView);
WidgetManager.register_widget_view('AccordionView', AccordionView);
var TabView = IPython.DOMWidgetView.extend({
@ -240,5 +240,5 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.containers[index].tab('show');
},
});
widget_manager.register_widget_view('TabView', TabView);
WidgetManager.register_widget_view('TabView', TabView);
});

View File

@ -14,7 +14,7 @@
* @namespace IPython
**/
define(["notebook/js/widgets/widget"], function(widget_manager){
define(["notebook/js/widgets/widget"], function(WidgetManager){
var HTMLView = IPython.DOMWidgetView.extend({
render : function(){
@ -31,7 +31,7 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
return HTMLView.__super__.update.apply(this);
},
});
widget_manager.register_widget_view('HTMLView', HTMLView);
WidgetManager.register_widget_view('HTMLView', HTMLView);
var LatexView = IPython.DOMWidgetView.extend({
@ -51,7 +51,7 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
return LatexView.__super__.update.apply(this);
},
});
widget_manager.register_widget_view('LatexView', LatexView);
WidgetManager.register_widget_view('LatexView', LatexView);
var TextAreaView = IPython.DOMWidgetView.extend({
@ -124,7 +124,7 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.touch();
},
});
widget_manager.register_widget_view('TextAreaView', TextAreaView);
WidgetManager.register_widget_view('TextAreaView', TextAreaView);
var TextBoxView = IPython.DOMWidgetView.extend({
@ -193,5 +193,5 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
}
},
});
widget_manager.register_widget_view('TextBoxView', TextBoxView);
WidgetManager.register_widget_view('TextBoxView', TextBoxView);
});