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