Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 | 3 |
4 YUI.add('subapp-browser-charmview', function(Y) { | 4 YUI.add('subapp-browser-charmview', function(Y) { |
5 var ns = Y.namespace('juju.browser.views'), | 5 var ns = Y.namespace('juju.browser.views'), |
6 views = Y.namespace('juju.views'), | 6 views = Y.namespace('juju.views'), |
7 widgets = Y.namespace('juju.widgets'); | 7 widgets = Y.namespace('juju.widgets'); |
8 | 8 |
9 | 9 |
10 /** | 10 /** |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 }, | 94 }, |
95 | 95 |
96 /** | 96 /** |
97 * Watch the tab control for change events and dispatch accordingly. | 97 * Watch the tab control for change events and dispatch accordingly. |
98 * | 98 * |
99 * @method _bindTabEvents | 99 * @method _bindTabEvents |
100 * @param {TabView} tab the tab control to monitor. | 100 * @param {TabView} tab the tab control to monitor. |
101 * | 101 * |
102 */ | 102 */ |
103 _dispatchTabEvents: function(tab) { | 103 _dispatchTabEvents: function(tab) { |
104 tab.after('selectionChange', function(ev) { | 104 this._events.push(tab.after('selectionChange', function(ev) { |
jeff.pihach
2013/04/01 19:49:23
do we want to destroy this event handler at any ti
rharding
2013/04/01 20:06:51
Sure, I was thinking the tabview is destroyed, but
| |
105 var tab = ev.newVal.get('content'); | 105 var tab = ev.newVal.get('content'); |
106 switch (tab) { | 106 switch (tab) { |
107 // @todo to be added later. Placed in now to make the linter happy | 107 // @todo to be added later. Placed in now to make the linter happy |
108 // with the switch statement. | 108 // with the switch statement. |
109 case 'Configuration': | 109 case 'Configuration': |
110 console.log('not implemented config handler'); | 110 console.log('not implemented config handler'); |
111 break; | 111 break; |
112 case 'Interfaces': | 112 case 'Interfaces': |
113 console.log('not implemented interfaces handler'); | 113 console.log('not implemented interfaces handler'); |
114 break; | 114 break; |
115 case 'Quality': | 115 case 'Quality': |
116 this._loadQAContent(); | 116 this._loadQAContent(); |
117 break; | 117 break; |
118 default: | 118 default: |
119 break; | 119 break; |
120 } | 120 } |
121 }, this); | 121 }, this)); |
122 }, | 122 }, |
123 | 123 |
124 /** | 124 /** |
125 * Event handler for clicking on a hook filename to load that file. | 125 * Event handler for clicking on a hook filename to load that file. |
126 * | 126 * |
127 * @method _loadHookContent | 127 * @method _loadHookContent |
128 * @param {Event} ev the click event created. | 128 * @param {Event} ev the click event created. |
129 * | 129 * |
130 */ | 130 */ |
131 _loadHookContent: function(ev) { | 131 _loadHookContent: function(ev) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 /** | 244 /** |
245 * Clean up after ourselves. | 245 * Clean up after ourselves. |
246 * | 246 * |
247 * @method destructor | 247 * @method destructor |
248 * | 248 * |
249 */ | 249 */ |
250 destructor: function() { | 250 destructor: function() { |
251 if (this.tabview) { | 251 if (this.tabview) { |
252 this.tabview.destroy(); | 252 this.tabview.destroy(); |
253 } | 253 } |
254 | |
255 Y.Array.each(this._events, function(ev) { | |
256 ev.detach(); | |
257 }); | |
254 }, | 258 }, |
255 | 259 |
256 /** | 260 /** |
257 * Generic YUI initializer. Make sure we track indicators for cleanup. | 261 * Generic YUI initializer. Make sure we track indicators for cleanup. |
258 * | 262 * |
259 * @method initializer | 263 * @method initializer |
260 * @param {Object} cfg configuration object. | 264 * @param {Object} cfg configuration object. |
261 * | 265 * |
262 */ | 266 */ |
263 initializer: function(cfg) { | 267 initializer: function(cfg) { |
264 // Hold onto references of the indicators used so we can clean them all | 268 // Hold onto references of the indicators used so we can clean them all |
265 // up. Indicators are keyed on their yuiid so we don't dupe them. | 269 // up. Indicators are keyed on their yuiid so we don't dupe them. |
266 this.indicators = {}; | 270 this.indicators = {}; |
271 this._events = []; | |
267 }, | 272 }, |
268 | 273 |
269 /** | 274 /** |
270 * Render out the view to the DOM. | 275 * Render out the view to the DOM. |
271 * | 276 * |
272 * @method render | 277 * @method render |
273 * @param {Node} container optional specific container to render out to. | 278 * @param {Node} container optional specific container to render out to. |
274 * | 279 * |
275 */ | 280 */ |
276 render: function(container) { | 281 render: function(container) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 requires: [ | 336 requires: [ |
332 'browser-overlay-indicator', | 337 'browser-overlay-indicator', |
333 'browser-tabview', | 338 'browser-tabview', |
334 'gallery-markdown', | 339 'gallery-markdown', |
335 'juju-templates', | 340 'juju-templates', |
336 'juju-views', | 341 'juju-views', |
337 'prettify', | 342 'prettify', |
338 'view' | 343 'view' |
339 ] | 344 ] |
340 }); | 345 }); |
LEFT | RIGHT |