2016-05-09 19:48:05 +02:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular
|
|
|
|
.module('harbor.layout.header')
|
|
|
|
.controller('HeaderController', HeaderController);
|
|
|
|
|
2016-06-21 12:42:53 +02:00
|
|
|
HeaderController.$inject = ['$scope', '$window', 'getParameterByName', '$location', 'currentUser'];
|
2016-05-09 19:48:05 +02:00
|
|
|
|
2016-06-21 12:42:53 +02:00
|
|
|
function HeaderController($scope, $window, getParameterByName, $location, currentUser) {
|
2016-05-19 06:50:32 +02:00
|
|
|
var vm = this;
|
2016-06-21 12:42:53 +02:00
|
|
|
vm.user = currentUser.get();
|
|
|
|
|
|
|
|
if(location.pathname === '/dashboard') {
|
|
|
|
vm.defaultUrl = '/dashboard';
|
|
|
|
}else{
|
|
|
|
vm.defaultUrl = '/';
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.$watch('vm.user', function(current) {
|
|
|
|
if(current) {
|
|
|
|
vm.defaultUrl = '/dashboard';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-05-19 06:50:32 +02:00
|
|
|
if($window.location.search) {
|
|
|
|
vm.searchInput = getParameterByName('q', $window.location.search);
|
|
|
|
console.log('vm.searchInput at header:' + vm.searchInput);
|
|
|
|
}
|
2016-05-09 19:48:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
})();
|