OSDN Git Service

Modified: Upload, Command execution
[eos/zephyr.git] / front-end / app / scripts / services / MyModal.ts
1 namespace app.services {
2     export class MyModal {
3
4         private $uibModal: ng.ui.bootstrap.IModalService;
5         private modalOption: ng.ui.bootstrap.IModalSettings;
6         public static $inject = ['$uibModal'];
7
8         constructor($uibModal: ng.ui.bootstrap.IModalService) {
9             this.$uibModal = $uibModal;
10             this.modalOption = {
11                 backdrop: true,
12                 controller: null,
13                 templateUrl: null,
14                 size: null
15             }
16         }
17
18         public open(modalName: string): ng.ui.bootstrap.IModalServiceInstance {
19         //public open(modalName: string): string {
20             if(modalName === 'SelectCommand') {
21                //this.modalOption.controller = 'SelectCommandController';
22                this.modalOption.templateUrl = 'templates/select-command.html';
23                this.modalOption.size = 'lg';
24            }
25            return this.$uibModal.open(this.modalOption);
26
27            //return modalName;
28         }
29
30         public selectCommand(): ng.ui.bootstrap.IModalServiceInstance {
31             this.modalOption.templateUrl = 'templates/select-command.html';
32             this.modalOption.controller = 'selectCommandController';
33             this.modalOption.controllerAs = 'c';
34             this.modalOption.size = 'lg';
35             return this.$uibModal.open(this.modalOption);
36         }
37
38         public preview(): ng.ui.bootstrap.IModalServiceInstance {
39             this.modalOption.templateUrl = 'templates/preview.html';
40             this.modalOption.controller = 'previewController';
41             this.modalOption.controllerAs = 'c';
42             this.modalOption.size = 'lg';
43             return this.$uibModal.open(this.modalOption);
44         }
45
46         public upload(): ng.ui.bootstrap.IModalServiceInstance {
47           this.modalOption.templateUrl = 'templates/upload.html';
48           this.modalOption.controller = 'uploadController';
49           this.modalOption.controllerAs ='c';
50           this.modalOption.size = 'lg';
51           return this.$uibModal.open(this.modalOption);
52         }
53
54     }
55 }