Merge pull request #36 from cmgustavo/matias/feature/identity

top-bar with dynamic titles
This commit is contained in:
Matias Alejo Garcia 2014-10-27 23:13:30 -03:00
commit e87d6165dd
25 changed files with 184 additions and 80 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('SidebarController', function($scope, $rootScope, $sce, $location, $http, $filter, notification, controllerUtils) {
angular.module('copayApp.controllers').controller('SidebarController', function($scope, $rootScope, $location, controllerUtils) {
$scope.menu = [{
'title': 'Receive',
@ -20,20 +20,6 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
'link': 'more'
}];
$scope.signout = function() {
logout();
};
// Ensures a graceful disconnect
window.onbeforeunload = function() {
controllerUtils.logout();
};
$scope.$on('$destroy', function() {
window.onbeforeunload = undefined;
});
$scope.refresh = function() {
var w = $rootScope.wallet;
if (!w) return;
@ -53,32 +39,7 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
return item.link && item.link == $location.path().split('/')[1];
};
function logout() {
controllerUtils.logout();
}
// ng-repeat defined number of times instead of repeating over array?
$scope.getNumber = function(num) {
return new Array(num);
}
if ($rootScope.wallet) {
$scope.$on('$idleWarn', function(a, countdown) {
if (!(countdown % 5))
notification.warning('Session will be closed', $filter('translate')('Your session is about to expire due to inactivity in') + ' ' + countdown + ' ' + $filter('translate')('seconds'));
});
$scope.$on('$idleTimeout', function() {
$scope.signout();
notification.warning('Session closed', 'Session closed because a long time of inactivity');
});
$scope.$on('$keepalive', function() {
if ($rootScope.wallet) {
$rootScope.wallet.keepAlive();
}
});
$rootScope.$watch('wallet.id', function() {
$scope.walletSelection = false;
});