zephyr.filter('Tag', filters.Tag);
zephyr.controller('selectCommandController', controllers.SelectCommand);
+ zephyr.controller('previewController', controllers.Preview);
zephyr.service('MyModal', services.MyModal);
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() {
--- /dev/null
+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';
+ */
+
+ }
+
+ }
+}
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()
private changeTag(tag: string) {
this.currentTag = tag;
}
+
+ private selectCommand(command:string) {
+ this.$modalInstance.close(command);
+ }
+
}
}
export class CommandController {
- public static $inject = ['APIEndPoint', '$scope'];
+ public static $inject = ['APIEndPoint', '$scope', 'MyModal'];
// From parent directive bindToController property
private index: string;
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
}
public debug() {
- console.log(this.files);
- console.log(this.files);
- console.log(this.workspace);
+ this.MyModal.preview();
}
}
}
import './controllers/Workspace.ts';
import './controllers/History.ts';
import './controllers/SelectCommand.ts';
+import './controllers/Preview.ts';
import './App.ts';
/// <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" />
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;
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);
+ }
+
}
}