OSDN Git Service

Modified: Upload, Command execution
[eos/zephyr.git] / front-end / app / scripts / directives / HeaderMenu.ts
1 namespace app.directives {
2
3     export class HeaderMenu implements ng.IDirective {
4
5         public restrict: string;
6         public replace: boolean;
7         public templateUrl: string;
8         public controller: string;
9         public controllerAs: string;
10         public scope: boolean;
11
12         /**
13          * constructor
14          *
15          * @param 
16          */
17         constructor() {
18             this.restrict = 'E';
19             this.replace = true;
20             this.templateUrl = 'templates/header-menu.html';
21             this.controller = 'HeaderMenuController';
22             this.controllerAs = 'hmc';
23             this.scope = true;
24         }
25
26         /**
27          * instance生成
28          * @returns {function(): HeaderMenu}
29          * @constructor
30          */
31         public static Factory(): ng.IDirectiveFactory {
32             var directive = () => {
33                 return new HeaderMenu();
34             };
35             return directive;
36         }
37     }
38
39     export class HeaderMenuController {
40
41         public static $inject = ['$state'];
42
43         private isExecution: boolean;
44         private isWorkspace: boolean;
45         private isHistory: boolean;
46
47         constructor(private $state: ng.ui.IStateService) {
48             this.isExecution = this.$state.current.name === 'execution';
49             this.isWorkspace = this.$state.current.name === 'workspace';
50             this.isHistory = this.$state.current.name === 'history';
51         }
52
53         private transit(state:string) {
54             this.$state.go(state);
55         }
56     }
57 }