diff --git a/IPython/html/static/notebook/js/widgets/base.js b/IPython/html/static/notebook/js/widgets/base.js index 863acf6..fb8b7ef 100644 --- a/IPython/html/static/notebook/js/widgets/base.js +++ b/IPython/html/static/notebook/js/widgets/base.js @@ -45,19 +45,6 @@ function(widget_manager, underscore, backbone){ return Backbone.Model.apply(this); }, - - - update_other_views: function (caller) { - this.last_modified_view = caller; - this.save(this.changedAttributes(), {patch: true}); - - for (var view_index in this.views) { - var view = this.views[view_index]; - if (view !== caller) { - view.update(); - } - } - }, send: function (content, cell) { @@ -507,6 +494,12 @@ function(widget_manager, underscore, backbone){ this.model.send(content, this.cell); }, + + touch: function () { + this.model.last_modified_view = this; + this.model.save(this.model.changedAttributes(), {patch: true}); + }, + update: function () { if (this.model.get('visible') !== undefined) { if (this.visible != this.model.get('visible')) { diff --git a/IPython/html/static/notebook/js/widgets/bool.js b/IPython/html/static/notebook/js/widgets/bool.js index 9d57f7d..8f805e0 100644 --- a/IPython/html/static/notebook/js/widgets/bool.js +++ b/IPython/html/static/notebook/js/widgets/bool.js @@ -35,7 +35,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ .click(function(el) { that.user_invoked_update = true; that.model.set('value', that.$checkbox.prop('checked')); - that.model.update_other_views(that); + that.touch(); that.user_invoked_update = false; }) .appendTo(this.$el); @@ -113,7 +113,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ handleClick: function(e) { this.user_invoked_update = true; this.model.set('value', ! $(e.target).hasClass('active')); - this.model.update_other_views(this); + this.touch(); this.user_invoked_update = false; }, }); diff --git a/IPython/html/static/notebook/js/widgets/float_range.js b/IPython/html/static/notebook/js/widgets/float_range.js index a295c07..e9f29a3 100644 --- a/IPython/html/static/notebook/js/widgets/float_range.js +++ b/IPython/html/static/notebook/js/widgets/float_range.js @@ -109,7 +109,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ events: { "slide" : "handleSliderChange" }, handleSliderChange: function(e, ui) { this.model.set('value', ui.value); - this.model.update_other_views(this); + this.touch(); }, }); @@ -189,7 +189,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ if (numericalValue != this.model.get('value')) { this.changing = true; this.model.set('value', numericalValue); - this.model.update_other_views(this); + this.touch(); this.changing = false; } } diff --git a/IPython/html/static/notebook/js/widgets/int_range.js b/IPython/html/static/notebook/js/widgets/int_range.js index d7c3cb6..6f7532b 100644 --- a/IPython/html/static/notebook/js/widgets/int_range.js +++ b/IPython/html/static/notebook/js/widgets/int_range.js @@ -109,7 +109,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ events: { "slide" : "handleSliderChange" }, handleSliderChange: function(e, ui) { this.model.set('value', ~~ui.value); // Double bit-wise not to truncate decimel - this.model.update_other_views(this); + this.touch(); }, }); @@ -188,7 +188,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ if (numericalValue != this.model.get('value')) { this.changing = true; this.model.set('value', numericalValue); - this.model.update_other_views(this); + this.touch(); this.changing = false; } } diff --git a/IPython/html/static/notebook/js/widgets/multicontainer.js b/IPython/html/static/notebook/js/widgets/multicontainer.js index f4975c0..a93f4e5 100644 --- a/IPython/html/static/notebook/js/widgets/multicontainer.js +++ b/IPython/html/static/notebook/js/widgets/multicontainer.js @@ -76,7 +76,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ .attr('href', '#' + uuid) .click(function(evt){ that.model.set("selected_index", index); - that.model.update_other_views(that); + that.touch(); }) .html('Page ' + index) .appendTo(accordion_heading); @@ -151,7 +151,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ .appendTo(tab) .click(function (e) { that.model.set("selected_index", index); - that.model.update_other_views(that); + that.touch(); that.select_page(index); }); this.containers.push(tab_text); diff --git a/IPython/html/static/notebook/js/widgets/selection.js b/IPython/html/static/notebook/js/widgets/selection.js index 43c7f65..59f8143 100644 --- a/IPython/html/static/notebook/js/widgets/selection.js +++ b/IPython/html/static/notebook/js/widgets/selection.js @@ -103,7 +103,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ // Handle when a value is clicked. handle_click: function (e) { this.model.set('value', $(e.target).html(), this); - this.model.update_other_views(this); + this.touch(); }, }); @@ -190,7 +190,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ // Handle when a value is clicked. handle_click: function (e) { this.model.set('value', $(e.target).val(), this); - this.model.update_other_views(this); + this.touch(); }, }); @@ -272,7 +272,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ // Handle when a value is clicked. handle_click: function (e) { this.model.set('value', $(e.target).html(), this); - this.model.update_other_views(this); + this.touch(); }, }); @@ -351,7 +351,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ // Handle when a value is clicked. handle_click: function (e) { this.model.set('value', $(e.target).html(), this); - this.model.update_other_views(this); + this.touch(); }, }); diff --git a/IPython/html/static/notebook/js/widgets/string.js b/IPython/html/static/notebook/js/widgets/string.js index da759ac..fc97992 100644 --- a/IPython/html/static/notebook/js/widgets/string.js +++ b/IPython/html/static/notebook/js/widgets/string.js @@ -119,7 +119,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ handleChanging: function(e) { this.user_invoked_update = true; this.model.set('value', e.target.value); - this.model.update_other_views(this); + this.touch(); this.user_invoked_update = false; }, }); @@ -173,7 +173,7 @@ define(["notebook/js/widgets/base"], function(widget_manager){ // Handles and validates user input. handleChanging: function(e) { this.model.set('value', e.target.value); - this.model.update_other_views(this); + this.touch(); }, // Handles text submition