Wallet/js/controllers/header.js

58 lines
1.3 KiB
JavaScript
Raw Normal View History

2014-03-25 11:35:04 -03:00
'use strict';
angular.module('copay.header').controller('HeaderController',
function($scope, $rootScope, $location, walletFactory, controllerUtils) {
2014-04-29 19:26:12 -03:00
$scope.menu = [
{
'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) {
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();
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;
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-20 19:39:16 -03:00
$rootScope.isCollapsed = true;
2014-03-25 11:35:04 -03:00
});