diff --git a/public/views/includes/menu-item.html b/public/views/includes/menu-item.html index 9ba10dec2..5f85ce3c5 100644 --- a/public/views/includes/menu-item.html +++ b/public/views/includes/menu-item.html @@ -1,4 +1,4 @@ - +
{{ item.title|translate }} diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 676ce7cb9..7983210ec 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, lodash, go, profileService, configService, isCordova, rateService, storageService, addressService, gettextCatalog, gettext, amMoment, nodeWebkit, addonManager, feeService, isChromeApp, bwsError, utilService) { +angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, lodash, go, profileService, configService, isCordova, rateService, storageService, addressService, gettextCatalog, gettext, amMoment, nodeWebkit, addonManager, feeService, isChromeApp, bwsError, utilService, $state) { var self = this; self.isCordova = isCordova; self.onGoingProcess = {}; @@ -143,6 +143,19 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.setTab = function(tab, reset, tries) { tries = tries || 0; + + // check if the whole menu item passed + if (typeof tab == 'object') { + if (tab.open) { + if (tab.link) { + self.tab = tab.link; + } + tab.open(); + return; + } else { + return self.setTab(tab.link); + } + } if (self.tab === tab && !reset) return; @@ -152,27 +165,30 @@ angular.module('copayApp.controllers').controller('indexController', function($r }, 300); } - if (!self.tab) + if (!self.tab || !$state.is('walletHome')) self.tab = 'walletHome'; - if (document.getElementById(self.tab)) { - document.getElementById(self.tab).className = 'tab-out tab-view ' + self.tab; - var old = document.getElementById('menu-' + self.tab); - if (old) { - old.className = ''; - } - } + go.path('walletHome', function() { - if (document.getElementById(tab)) { - document.getElementById(tab).className = 'tab-in tab-view ' + tab; - var newe = document.getElementById('menu-' + tab); - if (newe) { - newe.className = 'active'; + if (document.getElementById(self.tab)) { + document.getElementById(self.tab).className = 'tab-out tab-view ' + self.tab; + var old = document.getElementById('menu-' + self.tab); + if (old) { + old.className = ''; + } } - } - self.tab = tab; - $rootScope.$emit('Local/TabChanged', tab); + if (document.getElementById(tab)) { + document.getElementById(tab).className = 'tab-in tab-view ' + tab; + var newe = document.getElementById('menu-' + tab); + if (newe) { + newe.className = 'active'; + } + } + + self.tab = tab; + $rootScope.$emit('Local/TabChanged', tab); + }); };