mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
37 lines
896 B
JavaScript
37 lines
896 B
JavaScript
angular.module('app').directive('shipyardHeader', ['$rootScope', 'Persist', function ($rootScope, Persist) {
|
|
|
|
return {
|
|
restrict: 'E',
|
|
templateUrl: 'views/_header.html',
|
|
scope: true,
|
|
link: function (scope) {
|
|
scope.openedMenu = null;
|
|
scope.ships = DB.ships;
|
|
scope.allBuilds = Persist.builds;
|
|
scope.bs = Persist.state;
|
|
console.log(scope);
|
|
|
|
$rootScope.$on('$stateChangeStart',function(){
|
|
scope.openedMenu = null;
|
|
});
|
|
|
|
$rootScope.$on('close', function (e, keyEvent) {
|
|
scope.openedMenu = null;
|
|
});
|
|
|
|
scope.openMenu = function (menu) {
|
|
if(menu == scope.openedMenu) {
|
|
scope.openedMenu = null;
|
|
return;
|
|
}
|
|
|
|
if (menu == 'b' && !scope.bs.hasBuilds) {
|
|
scope.openedMenu = null;
|
|
return;
|
|
}
|
|
scope.openedMenu = menu;
|
|
};
|
|
|
|
}
|
|
};
|
|
}]); |