##// END OF EJS Templates
widget changes continued
sylvain.corlay -
Show More
@@ -409,11 +409,9 define(["widgets/js/manager",
409 409 // Public constructor
410 410 DOMWidgetView.__super__.initialize.apply(this, arguments);
411 411 this.on('displayed', this.show, this);
412
413 412 this.model.on('msg:custom', this.on_msg, this);
414 413 this.model.on('change:visible', this.update_visible, this);
415 414 this.model.on('change:_css', this.update_css, this);
416
417 415 this.update_visible(this.model, this.model.get("visible"));
418 416 this.update_css(this.model, this.model.get("_css"));
419 417 },
@@ -450,7 +448,7 define(["widgets/js/manager",
450 448 },
451 449
452 450 update_css: function (model, css) {
453 // Update the contents of this view
451 // Update the css styling of this view.
454 452 var e = this.$el;
455 453 if (css === undefined) {return;}
456 454 for (var i = 0; i < css.length; i++) {
@@ -39,7 +39,7 define([
39 39 var view = this.create_child_view(model);
40 40 this.$el.append(view.$el);
41 41
42 // Trigger the displayed event once this view is displayed.
42 // Trigger the displayed event of the child view.
43 43 this.after_displayed(function() {
44 44 view.trigger('displayed');
45 45 });
@@ -221,7 +221,7 define([
221 221 var view = this.create_child_view(model);
222 222 this.$body.append(view.$el);
223 223
224 // Trigger the displayed event once this view is displayed.
224 // Trigger the displayed event of the child view.
225 225 this.after_displayed(function() {
226 226 view.trigger('displayed');
227 227 });
@@ -30,15 +30,7 define([
30 30 var that = this;
31 31 this.on('displayed', function() {
32 32 this.update_titles();
33 // Trigger model displayed events for any models that are child to
34 // this model when this model is displayed.
35 that.is_displayed = true;
36 for (var property in that.child_views) {
37 if (that.child_views.hasOwnProperty(property)) {
38 that.child_views[property].trigger('displayed');
39 33 }
40 }
41 }, this);
42 34 },
43 35
44 36 update_titles: function(titles) {
@@ -127,10 +119,10 define([
127 119 this.update();
128 120 this.update_titles();
129 121
130 // Trigger the displayed event if this model is displayed.
131 if (this.is_displayed) {
122 // Trigger the displayed event of the child view.
123 this.after_displayed(function() {
132 124 view.trigger('displayed');
133 }
125 });
134 126 },
135 127 });
136 128
@@ -158,17 +150,6 define([
158 150 this.model.on('change:children', function(model, value, options) {
159 151 this.update_children(model.previous('children'), value);
160 152 }, this);
161
162 // Trigger model displayed events for any models that are child to
163 // this model when this model is displayed.
164 this.on('displayed', function(){
165 that.is_displayed = true;
166 for (var property in that.child_views) {
167 if (that.child_views.hasOwnProperty(property)) {
168 that.child_views[property].trigger('displayed');
169 }
170 }
171 });
172 153 },
173 154
174 155 update_children: function(old_list, new_list) {
@@ -222,10 +203,10 define([
222 203 .appendTo(this.$tab_contents);
223 204 view.parent_container = contents_div;
224 205
225 // Trigger the displayed event if this model is displayed.
226 if (this.is_displayed) {
206 // Trigger the displayed event of the child view.
207 this.after_displayed(function() {
227 208 view.trigger('displayed');
228 }
209 });
229 210 },
230 211
231 212 update: function(options) {
General Comments 0
You need to be logged in to leave comments. Login now