copay/js/controllers/header.js

47 lines
969 B
JavaScript
Raw Normal View History

2014-03-25 07:35:04 -07:00
'use strict';
angular.module('copay.header').controller('HeaderController',
function($scope, $rootScope, $location, Network) {
2014-03-26 05:18:42 -07:00
$scope.menu = [{
'title': 'Home',
'link': '#/home'
}, {
'title': 'Copayers',
'link': '#/peer'
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
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() {
Network.disconnect(function() {
$location.path('signin');
});
2014-03-25 07:35:04 -07:00
};
2014-04-09 07:05:25 -07:00
$scope.clearFlashMessage = function() {
$rootScope.flashMessage = {};
};
2014-03-25 07:35:04 -07:00
});