2014-03-25 07:35:04 -07:00
|
|
|
'use strict';
|
|
|
|
|
2014-03-28 11:08:14 -07:00
|
|
|
angular.module('copay.header').controller('HeaderController',
|
2014-03-31 08:48:35 -07:00
|
|
|
function($scope, $rootScope, $location, Network) {
|
2014-03-26 05:18:42 -07:00
|
|
|
$scope.menu = [{
|
|
|
|
'title': 'Home',
|
2014-03-31 08:48:35 -07:00
|
|
|
'link': '#/home'
|
2014-03-26 05:18:42 -07:00
|
|
|
}, {
|
|
|
|
'title': 'Transactions',
|
|
|
|
'link': '#/transactions'
|
|
|
|
}, {
|
|
|
|
'title': 'Send',
|
|
|
|
'link': '#/send'
|
|
|
|
}, {
|
|
|
|
'title': 'Backup',
|
|
|
|
'link': '#/backup'
|
|
|
|
}];
|
2014-03-25 07:35:04 -07:00
|
|
|
|
2014-03-31 08:48:35 -07:00
|
|
|
if (!$rootScope.peerId) {
|
|
|
|
$location.path('signin');
|
|
|
|
}
|
|
|
|
|
2014-03-26 05:18:42 -07:00
|
|
|
$scope.isActive = function(item) {
|
|
|
|
if (item.link.replace('#','') == $location.path()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
2014-03-25 07:35:04 -07:00
|
|
|
$scope.init = function() {
|
|
|
|
$rootScope.isLogged = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.signout = function() {
|
|
|
|
$rootScope.isLogged = false;
|
2014-04-04 14:29:32 -07:00
|
|
|
Network.disconnect(function() {
|
|
|
|
$location.path('signin');
|
|
|
|
});
|
2014-03-25 07:35:04 -07:00
|
|
|
};
|
|
|
|
});
|