widget changes continued

pull/37/head
sylvain.corlay 12 years ago
parent 972fbb5f34
commit 34fe520742

@ -409,11 +409,9 @@ define(["widgets/js/manager",
// Public constructor
DOMWidgetView.__super__.initialize.apply(this, arguments);
this.on('displayed', this.show, this);
this.model.on('msg:custom', this.on_msg, this);
this.model.on('change:visible', this.update_visible, this);
this.model.on('change:_css', this.update_css, this);
this.update_visible(this.model, this.model.get("visible"));
this.update_css(this.model, this.model.get("_css"));
},
@ -450,7 +448,7 @@ define(["widgets/js/manager",
},
update_css: function (model, css) {
// Update the contents of this view
// Update the css styling of this view.
var e = this.$el;
if (css === undefined) {return;}
for (var i = 0; i < css.length; i++) {

@ -39,7 +39,7 @@ define([
var view = this.create_child_view(model);
this.$el.append(view.$el);
// Trigger the displayed event once this view is displayed.
// Trigger the displayed event of the child view.
this.after_displayed(function() {
view.trigger('displayed');
});
@ -221,7 +221,7 @@ define([
var view = this.create_child_view(model);
this.$body.append(view.$el);
// Trigger the displayed event once this view is displayed.
// Trigger the displayed event of the child view.
this.after_displayed(function() {
view.trigger('displayed');
});

@ -30,15 +30,7 @@ define([
var that = this;
this.on('displayed', function() {
this.update_titles();
// Trigger model displayed events for any models that are child to
// this model when this model is displayed.
that.is_displayed = true;
for (var property in that.child_views) {
if (that.child_views.hasOwnProperty(property)) {
that.child_views[property].trigger('displayed');
}
}
}, this);
}
},
update_titles: function(titles) {
@ -127,10 +119,10 @@ define([
this.update();
this.update_titles();
// Trigger the displayed event if this model is displayed.
if (this.is_displayed) {
// Trigger the displayed event of the child view.
this.after_displayed(function() {
view.trigger('displayed');
}
});
},
});
@ -158,17 +150,6 @@ define([
this.model.on('change:children', function(model, value, options) {
this.update_children(model.previous('children'), value);
}, this);
// Trigger model displayed events for any models that are child to
// this model when this model is displayed.
this.on('displayed', function(){
that.is_displayed = true;
for (var property in that.child_views) {
if (that.child_views.hasOwnProperty(property)) {
that.child_views[property].trigger('displayed');
}
}
});
},
update_children: function(old_list, new_list) {
@ -222,10 +203,10 @@ define([
.appendTo(this.$tab_contents);
view.parent_container = contents_div;
// Trigger the displayed event if this model is displayed.
if (this.is_displayed) {
// Trigger the displayed event of the child view.
this.after_displayed(function() {
view.trigger('displayed');
}
});
},
update: function(options) {

Loading…
Cancel
Save