make JS update comment more descriptive (english)

This commit is contained in:
Jonathan Frederic 2014-01-08 10:49:45 +00:00
parent 0740980d5c
commit ccbfcbc159
8 changed files with 73 additions and 26 deletions

View File

@ -269,8 +269,13 @@ function(widget_manager, underscore, backbone){
},
update: function () {
// the very first update seems to happen before the element is finished rendering
// so we use setTimeout to give the element time to render
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
// The very first update seems to happen before the element is
// finished rendering so we use setTimeout to give the element time
// to render
var e = this.$el;
var visible = this.model.get('visible');
setTimeout(function() {e.toggle(visible)},0);

View File

@ -44,9 +44,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.update(); // Set defaults.
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
if (!this.user_invoked_update) {
this.$checkbox.prop('checked', this.model.get('value'));
@ -84,9 +86,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.update(); // Set defaults.
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
if (!this.user_invoked_update) {
if (this.model.get('value')) {
this.$button.addClass('active');

View File

@ -30,9 +30,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.update(); // Set defaults.
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
var description = this.model.get('description');
description = description.replace(/ /g, ' ', 'm');
description = description.replace(/\n/g, '<br>\n', 'm');

View File

@ -69,6 +69,10 @@ define(["notebook/js/widgets/widget"], function(widget_manager) {
},
update: function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
set_flex_properties(this, this.$el);
return IPython.DOMWidgetView.prototype.update.call(this);
},
@ -225,6 +229,10 @@ define(["notebook/js/widgets/widget"], function(widget_manager) {
},
update: function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
set_flex_properties(this, this.$body);
var description = this.model.get('description');

View File

@ -26,9 +26,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.update(); // Set defaults.
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
var image_src = 'data:image/' + this.model.get('image_format') + ';base64,' + this.model.get('_b64value');
this.$el.attr('src', image_src);

View File

@ -45,6 +45,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
update: function() {
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
// Set tab titles
var titles = this.model.get('_titles');
for (var page_index in titles) {
@ -153,6 +158,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
},
update: function() {
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
// Set tab titles
var titles = this.model.get('_titles');
for (var page_index in titles) {

View File

@ -55,9 +55,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.update();
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
var selected_item_text = this.model.get('value');
selected_item_text = selected_item_text.replace(/ /g, '&nbsp;');
@ -129,9 +131,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.update();
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
// Add missing items to the DOM.
var items = this.model.get('values');
@ -216,9 +220,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.update();
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
// Add missing items to the DOM.
var items = this.model.get('values');
@ -298,9 +304,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.update();
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
// Add missing items to the DOM.
var items = this.model.get('values');

View File

@ -25,9 +25,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.update(); // Set defaults.
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
this.$el.html(this.model.get('value'));
return IPython.DOMWidgetView.prototype.update.call(this);
},
@ -44,9 +46,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.update(); // Set defaults.
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
this.$el.html(this.model.get('value'));
MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$el.get(0)]);
@ -91,9 +95,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update: function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
if (!this.user_invoked_update) {
this.$textbox.val(this.model.get('value'));
}
@ -145,9 +151,11 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
this.update(); // Set defaults.
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update: function(){
// Update the contents of this view
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
if (this.$textbox.val() != this.model.get('value')) {
this.$textbox.val(this.model.get('value'));
}