Active tabs

Jeff Pihach jeff.pihach at canonical.com
Thu Aug 1 13:43:03 UTC 2013


Hi Huw,

Yes that's to be expected, if you want that method to be called it will 
need to be in the viewlet-manager. Ping me when you get back in and I 
can run you through the different event objects and where they relate to.

-Jeff

Huw Wilkins wrote:
> 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.js2013-07-31 06:10:45 +0000
> +++ app/views/environment.js2013-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/e6272daf/attachment-0001.html>


More information about the Juju-GUI mailing list