mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 06:43:24 +00:00
UI improvements, save build feature partial implementation
This commit is contained in:
37
app/js/directives/directive-header.js
Normal file
37
app/js/directives/directive-header.js
Normal file
@@ -0,0 +1,37 @@
|
||||
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;
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
}]);
|
||||
Reference in New Issue
Block a user