harbor/static/ng/resources/js/components/details/switch-pane-projects.directive.js

51 lines
1.0 KiB
JavaScript
Raw Normal View History

(function() {
'use strict';
angular
.module('harbor.details')
.directive('switchPaneProjects', switchPaneProjects);
2016-04-19 19:20:07 +02:00
SwitchPaneProjectsController.$inject = ['$scope'];
function SwitchPaneProjectsController($scope) {
var vm = this;
2016-04-20 08:12:53 +02:00
$scope.$on('isOpen', function(e, val){
vm.isOpen = val;
2016-04-19 19:20:07 +02:00
});
2016-04-20 08:12:53 +02:00
2016-04-19 19:20:07 +02:00
$scope.$watch('vm.selectedProject', function(current, origin) {
vm.projectName = current.name;
});
vm.switchPane = switchPane;
function switchPane() {
2016-04-19 19:20:07 +02:00
if(vm.isOpen) {
vm.isOpen = false;
}else{
2016-04-19 19:20:07 +02:00
vm.isOpen = true;
}
}
}
function switchPaneProjects() {
var directive = {
restrict: 'E',
templateUrl: '/static/ng/resources/js/components/details/switch-pane-projects.directive.html',
replace: true,
scope: {
2016-04-19 19:20:07 +02:00
'selectedProject': '=',
'isOpen': '='
},
controller: SwitchPaneProjectsController,
controllerAs: 'vm',
bindToController: true
}
return directive;
}
})();