OSDN Git Service

[TMP] preview Modal v0.3.0p0046
authorhimetani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 10 Feb 2016 01:12:46 +0000 (10:12 +0900)
committerhimetani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 10 Feb 2016 01:12:46 +0000 (10:12 +0900)
front-end/app/scripts/App.ts
front-end/app/scripts/controllers/Execution.ts
front-end/app/scripts/controllers/Preview.ts [new file with mode: 0644]
front-end/app/scripts/controllers/SelectCommand.ts
front-end/app/scripts/directives/Command.ts
front-end/app/scripts/entry.ts
front-end/app/scripts/reference.ts
front-end/app/scripts/services/MyModal.ts

index d640627..d267df8 100644 (file)
@@ -39,6 +39,7 @@ namespace app {
 
     zephyr.filter('Tag', filters.Tag);
     zephyr.controller('selectCommandController', controllers.SelectCommand);
+    zephyr.controller('previewController', controllers.Preview);
 
     zephyr.service('MyModal', services.MyModal);
 
index a311de0..dc77834 100644 (file)
@@ -14,10 +14,15 @@ namespace app.controllers {
         public add() {
             // close all <uib-accordion> tag
             this.$scope.$broadcast('close');
+            var commandInfoList = this.commandInfoList;
             
             // add <command> directive
-            this.MyModal.selectCommand();
-            //this.commandInfoList.push(new declares.CommandInfo('mrcImageNoiseAdd'));
+            var commandInstance = this.MyModal.selectCommand();
+            commandInstance
+                .result
+                .then(function(command) {
+                    commandInfoList.push(new declares.CommandInfo(command));
+                });
         }
 
         public open() {
diff --git a/front-end/app/scripts/controllers/Preview.ts b/front-end/app/scripts/controllers/Preview.ts
new file mode 100644 (file)
index 0000000..1a939c2
--- /dev/null
@@ -0,0 +1,25 @@
+namespace app.controllers {
+    export class Preview{ 
+
+        public static $inject = ['$scope', 'APIEndPoint','$uibModalInstance'];
+        private tags: string[];
+        private commands: string[];
+        private searchText: string;
+        private currentTag: string;
+
+        constructor($scope: ng.IScope, private APIEndPoint: services.APIEndPoint, private $modalInstance: ng.ui.bootstrap.IModalServiceInstance) {
+            var controller = this;
+            console.log('preview');
+            /*
+            this.APIEndPoint
+                .getCommands()
+                .$promise.then((result) => {
+                   controller.commands = result.info; 
+                });
+            this.currentTag = 'all';
+            */
+
+        } 
+
+    }
+}
index ad5b060..e6971c7 100644 (file)
@@ -1,13 +1,13 @@
 namespace app.controllers {
     export class SelectCommand{ 
 
-        public static $inject = ['$scope', 'APIEndPoint'];
+        public static $inject = ['$scope', 'APIEndPoint','$uibModalInstance'];
         private tags: string[];
         private commands: string[];
         private searchText: string;
         private currentTag: string;
 
-        constructor($scope: ng.IScope, private APIEndPoint: services.APIEndPoint) {
+        constructor($scope: ng.IScope, private APIEndPoint: services.APIEndPoint, private $modalInstance: ng.ui.bootstrap.IModalServiceInstance) {
             var controller = this;
             this.APIEndPoint
                 .getTags()
@@ -27,5 +27,10 @@ namespace app.controllers {
         private changeTag(tag: string) {
             this.currentTag = tag;
         }
+
+        private selectCommand(command:string) {
+            this.$modalInstance.close(command);
+        }
+
     }
 }
index 93c9155..2516980 100644 (file)
@@ -45,7 +45,7 @@ namespace app.directives {
 
     export class CommandController {
 
-        public static $inject = ['APIEndPoint', '$scope'];
+        public static $inject = ['APIEndPoint', '$scope', 'MyModal'];
 
         // From parent directive bindToController property
         private index: string;
@@ -63,7 +63,7 @@ namespace app.directives {
         private options: declares.IOption[];
         private dirs: any;
 
-        constructor(private APIEndPoint: services.APIEndPoint, private $scope: ng.IScope) {
+        constructor(private APIEndPoint: services.APIEndPoint, private $scope: ng.IScope, private MyModal: services.MyModal) {
             var controller = this;
 
             // Get OptionControlFile and bind it to $scope.options
@@ -148,9 +148,7 @@ namespace app.directives {
         }
 
         public debug() {
-                    console.log(this.files);
-                    console.log(this.files);
-            console.log(this.workspace);
+            this.MyModal.preview();
         }
     } 
 }
index 86bf3c6..8e4fd24 100644 (file)
@@ -22,5 +22,6 @@ import './controllers/Execution.ts';
 import './controllers/Workspace.ts';
 import './controllers/History.ts';
 import './controllers/SelectCommand.ts';
+import './controllers/Preview.ts';
 
 import './App.ts';
index 401de15..bd92bcc 100644 (file)
@@ -14,5 +14,6 @@
 /// <reference path="./controllers/Workspace.ts" />
 /// <reference path="./controllers/History.ts" />
 /// <reference path="./controllers/SelectCommand.ts" />
+/// <reference path="./controllers/Preview.ts" />
 
 /// <reference path="./filters/Tag.ts" />
index 9629bd1..3c506e3 100644 (file)
@@ -3,6 +3,7 @@ namespace app.services {
 
         private $uibModal: ng.ui.bootstrap.IModalService;
         private modalOption: ng.ui.bootstrap.IModalSettings;
+        public static $inject = ['$uibModal'];
 
         constructor($uibModal: ng.ui.bootstrap.IModalService) { 
             this.$uibModal = $uibModal;
@@ -34,5 +35,13 @@ namespace app.services {
             return this.$uibModal.open(this.modalOption);
         }
 
+        public preview(): ng.ui.bootstrap.IModalServiceInstance {
+            this.modalOption.templateUrl = 'templates/preview.html';
+            this.modalOption.controller = 'previewController';
+            this.modalOption.controllerAs = 'c';
+            this.modalOption.size = 'lg';
+            return this.$uibModal.open(this.modalOption);
+        }
+
     }
 }