Añadidos estilos a elementos desabilitados, mejora de directiva vnAcl
This commit is contained in:
parent
041be5ec93
commit
571692f4ca
|
@ -38,5 +38,5 @@
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<button response="CANCEL" translate>Cancel</button>
|
<button response="CANCEL" translate>Cancel</button>
|
||||||
<button response="ACCEPT" translate>Change password</button>
|
<button response="ACCEPT" translate>Change password</button>
|
||||||
</tpl-body>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
||||||
|
|
|
@ -3,16 +3,23 @@ import {module} from '../module';
|
||||||
function vnAcl(aclService, $compile) {
|
function vnAcl(aclService, $compile) {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
link: function(scope, element, attrs) {
|
link: function($scope, $element, $attrs) {
|
||||||
let acls = attrs.vnAcl.split(',');
|
let acls = $attrs.vnAcl.split(',');
|
||||||
let action = attrs.vnAclAction || 'disabled';
|
let action = $attrs.vnAclAction || 'disabled';
|
||||||
if (!aclService.aclPermission(acls)) {
|
if (!aclService.aclPermission(acls)) {
|
||||||
if (action === 'disabled') {
|
if (action === 'disabled') {
|
||||||
let input = element[0].querySelector('input');
|
let input = $element[0];
|
||||||
input.setAttribute("ng-disabled", "true");
|
let selector = 'input, textarea, button, submit';
|
||||||
$compile(input)(scope);
|
|
||||||
|
if (!input.matches(selector))
|
||||||
|
input = input.querySelector(selector);
|
||||||
|
|
||||||
|
if (input) {
|
||||||
|
input.setAttribute("ng-disabled", "true");
|
||||||
|
$compile(input)($scope);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
element.remove();
|
$element.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.display-block{
|
.display-block {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.well {
|
.well {
|
||||||
|
@ -15,12 +15,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Label del popover */
|
/* Label del popover */
|
||||||
.popover-button{
|
.popover-button {
|
||||||
padding: 3px 3px 3px 0px;
|
padding: 3px 3px 3px 0px;
|
||||||
height: auto;
|
height: auto;
|
||||||
min-width: auto;
|
min-width: auto;
|
||||||
}
|
}
|
||||||
.popover-label{
|
.popover-label {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: black;
|
color: black;
|
||||||
padding-top:5px;
|
padding-top:5px;
|
||||||
|
@ -32,3 +32,9 @@
|
||||||
height: 46px;
|
height: 46px;
|
||||||
line-height: 0px;
|
line-height: 0px;
|
||||||
}
|
}
|
||||||
|
input:disabled, button:disabled {
|
||||||
|
cursor: not-allowed !important;
|
||||||
|
}
|
||||||
|
input[type="submit"]:disabled, button:disabled {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html ng-app="salix">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Salix</title>
|
<title>Salix</title>
|
||||||
<script src="/salix/acl"></script>
|
<script src="/salix/acl"></script>
|
||||||
</head>
|
</head>
|
||||||
<body ng-app="salix">
|
<body>
|
||||||
<vn-app></vn-app>
|
<vn-app></vn-app>
|
||||||
<script type="text/javascript"
|
<script type="text/javascript"
|
||||||
src="/static/routes.js">
|
src="/static/routes.js">
|
||||||
|
|
Loading…
Reference in New Issue