salix/front/core/directives/visible-by.js

19 lines
483 B
JavaScript

import ngModule from '../module';
function vnVisibleBy(aclService) {
return {
restrict: 'A',
priority: -1,
link: function($scope, $element, $attrs) {
let acls = $attrs.vnVisibleBy.replace(/\s/g, '');
acls = acls.split(',');
if (!aclService.hasAny(acls))
$element[0].style.visibility = 'hidden';
}
};
}
vnVisibleBy.$inject = ['aclService'];
ngModule.directive('vnVisibleBy', vnVisibleBy);