2016-05-12 12:30:01 +02:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular
|
|
|
|
.module('harbor.layout.admin.option')
|
|
|
|
.controller('AdminOptionController', AdminOptionController);
|
|
|
|
|
2016-07-02 12:20:31 +02:00
|
|
|
AdminOptionController.$inject = ['$scope', '$timeout', '$location'];
|
2016-05-31 12:49:16 +02:00
|
|
|
|
2016-07-02 12:20:31 +02:00
|
|
|
function AdminOptionController($scope, $timeout, $location) {
|
2016-06-25 21:12:17 +02:00
|
|
|
|
2016-06-26 06:56:58 +02:00
|
|
|
$scope.subsSubPane = 296;
|
|
|
|
|
2016-05-12 12:30:01 +02:00
|
|
|
var vm = this;
|
|
|
|
vm.toggle = false;
|
2016-07-02 12:20:31 +02:00
|
|
|
vm.target = 'users';
|
2016-05-12 12:30:01 +02:00
|
|
|
vm.toggleAdminOption = toggleAdminOption;
|
2016-07-02 12:20:31 +02:00
|
|
|
|
|
|
|
$scope.$on('$locationChangeSuccess', function(e) {
|
|
|
|
if($location.path() === '') {
|
|
|
|
vm.target = 'users';
|
|
|
|
vm.toggle = false;
|
|
|
|
}else{
|
|
|
|
vm.target = 'system_management';
|
|
|
|
vm.toggle = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
//Message dialog handler for admin-options.
|
|
|
|
$scope.$on('modalTitle', function(e, val) {
|
|
|
|
vm.modalTitle = val;
|
|
|
|
});
|
2016-05-12 12:30:01 +02:00
|
|
|
|
2016-07-02 12:20:31 +02:00
|
|
|
$scope.$on('modalMessage', function(e, val) {
|
|
|
|
vm.modalMessage = val;
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.$on('raiseError', function(e, val) {
|
|
|
|
if(val) {
|
|
|
|
vm.action = function() {
|
|
|
|
$scope.$broadcast('showDialog', false);
|
|
|
|
};
|
|
|
|
vm.contentType = 'text/plain';
|
|
|
|
vm.confirmOnly = true;
|
|
|
|
|
|
|
|
$timeout(function() {
|
|
|
|
$scope.$broadcast('showDialog', true);
|
|
|
|
}, 350);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.$on('raiseInfo', function(e, val) {
|
|
|
|
if(val) {
|
|
|
|
vm.action = function() {
|
|
|
|
val.action();
|
|
|
|
$scope.$broadcast('showDialog', false);
|
|
|
|
}
|
|
|
|
vm.contentType = val.contentType;
|
|
|
|
vm.confirmOnly = val.confirmOnly;
|
|
|
|
|
|
|
|
$scope.$broadcast('showDialog', true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function toggleAdminOption(e) {
|
|
|
|
switch(e.target) {
|
|
|
|
case 'users':
|
2016-05-12 12:30:01 +02:00
|
|
|
vm.toggle = false;
|
2016-07-02 12:20:31 +02:00
|
|
|
break;
|
|
|
|
case 'system_management':
|
2016-05-12 12:30:01 +02:00
|
|
|
vm.toggle = true;
|
2016-07-02 12:20:31 +02:00
|
|
|
break;
|
2016-05-31 12:49:16 +02:00
|
|
|
}
|
2016-07-02 12:20:31 +02:00
|
|
|
vm.target = e.target;
|
2016-05-12 12:30:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
})();
|