2014-03-25 11:35:04 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
2014-03-28 14:08:14 -04:00
|
|
|
angular.module('copay.header').controller('HeaderController',
|
2014-04-17 16:27:15 -03:00
|
|
|
function($scope, $rootScope, $location, walletFactory, controllerUtils) {
|
2014-04-29 19:26:12 -03:00
|
|
|
$scope.menu = [
|
|
|
|
|
{
|
2014-04-20 20:21:54 -03:00
|
|
|
'title': 'Addresses',
|
|
|
|
|
'icon': 'fi-address-book',
|
|
|
|
|
'link': '#/addresses'
|
2014-03-26 09:18:42 -03:00
|
|
|
}, {
|
|
|
|
|
'title': 'Transactions',
|
2014-04-15 12:33:00 -03:00
|
|
|
'icon': 'fi-loop',
|
2014-03-26 09:18:42 -03:00
|
|
|
'link': '#/transactions'
|
|
|
|
|
}, {
|
|
|
|
|
'title': 'Send',
|
2014-04-15 12:33:00 -03:00
|
|
|
'icon': 'fi-arrow-right',
|
2014-03-26 09:18:42 -03:00
|
|
|
'link': '#/send'
|
|
|
|
|
}, {
|
|
|
|
|
'title': 'Backup',
|
2014-04-15 12:33:00 -03:00
|
|
|
'icon': 'fi-archive',
|
2014-03-26 09:18:42 -03:00
|
|
|
'link': '#/backup'
|
2014-04-15 14:02:45 -03:00
|
|
|
}];
|
2014-03-25 11:35:04 -03:00
|
|
|
|
2014-04-18 19:08:01 -03:00
|
|
|
$rootScope.$watch('wallet', function(wallet) {
|
|
|
|
|
if (wallet) {
|
2014-05-13 04:03:09 -03:00
|
|
|
controllerUtils.updateTxs();
|
2014-04-18 19:08:01 -03:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2014-03-26 09:18:42 -03:00
|
|
|
$scope.isActive = function(item) {
|
2014-04-15 14:02:45 -03:00
|
|
|
if (item.link && item.link.replace('#','') == $location.path()) {
|
2014-03-26 09:18:42 -03:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
};
|
|
|
|
|
|
2014-03-25 11:35:04 -03:00
|
|
|
$scope.signout = function() {
|
2014-04-16 19:14:58 -03:00
|
|
|
var w = $rootScope.wallet;
|
|
|
|
|
if (w) {
|
|
|
|
|
w.disconnect();
|
2014-04-17 16:27:15 -03:00
|
|
|
controllerUtils.logout();
|
2014-04-16 19:14:58 -03:00
|
|
|
}
|
2014-04-30 19:50:13 -03:00
|
|
|
$scope.clearFlashMessage();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.refresh = function() {
|
2014-05-06 16:21:56 -03:00
|
|
|
var w = $rootScope.wallet;
|
2014-05-06 17:36:16 -03:00
|
|
|
w.connectToAll();
|
2014-04-30 19:50:13 -03:00
|
|
|
controllerUtils.updateBalance(function() {
|
|
|
|
|
});
|
2014-03-25 11:35:04 -03:00
|
|
|
};
|
2014-04-09 11:05:25 -03:00
|
|
|
|
|
|
|
|
$scope.clearFlashMessage = function() {
|
|
|
|
|
$rootScope.flashMessage = {};
|
|
|
|
|
};
|
2014-04-17 06:43:30 -03:00
|
|
|
|
2014-04-20 19:39:16 -03:00
|
|
|
$rootScope.isCollapsed = true;
|
2014-03-25 11:35:04 -03:00
|
|
|
});
|