Active tabs

Huw Wilkins huw.wilkins at canonical.com
Thu Aug 1 06:43:43 UTC 2013


Hi,

In the inspector I need to be able to set the current tab (currently S C E
D) to an active icon. However I'm not sure how to get the fired event to
call the function. Diff here:

=== modified file 'app/views/environment.js'
--- app/views/environment.js 2013-07-31 06:10:45 +0000
+++ app/views/environment.js 2013-08-01 06:38:27 +0000
@@ -179,7 +179,7 @@
             },
             configService: {
               events: {
-                '.tab': {'click': 'showViewlet'}
+                '.tab': {'click': '_switchTab'}
               },
               viewletEvents: {
                 // Viewlet wrapper viewlet.
@@ -369,6 +369,22 @@
         _attachTopoEvents: function() {
           this.topo.on(
               '*:destroyServiceInspector', this.destroyInspector, this);
+        },
+
+        /**
+          Switch tab viewlet.
+
+          @method _switchTab
+        */
+        _switchTab: function(ev) {
+          /* This doesn't get run. I want to show the tab and set the link
active here. */
+          ev.halt();
+          var container = this.get('container'),
+              target = ev.currentTarget,
+              state = target.getData('viewlet');
+          this.viewletManager.showViewlet('unitDetails');
+          container.one('tab.active').removeClass('active');
+          target.addClass('active');
         }
       }, {
         ATTRS: {

Any suggestions?

Cheers,

Huw
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-gui/attachments/20130801/0f953d70/attachment-0001.html>


More information about the Juju-GUI mailing list