hotfix #2135 - Don't enable inputs disabled by ACL directive
gitea/salix/master This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-02-20 09:32:47 +01:00
parent a148daa368
commit 17523a2207
3 changed files with 14 additions and 5 deletions

View File

@ -26,8 +26,10 @@ export default class Button extends FormInput {
} }
onClick(event) { onClick(event) {
if (this.disabled) if (this.disabled) {
event.preventDefault();
event.stopImmediatePropagation(); event.stopImmediatePropagation();
}
} }
} }
Button.$inject = ['$element', '$scope']; Button.$inject = ['$element', '$scope'];

View File

@ -14,10 +14,13 @@ export function directive($parse) {
const cb = $parse($attrs.vnHttpClick); const cb = $parse($attrs.vnHttpClick);
const element = $element[0]; const element = $element[0];
$element.on('click', () => { $element.on('click', () => {
element.$ctrl.disabled = true; const controller = element.$ctrl;
controller.$oldDisabled = field.$ctrl.disabled;
controller.disabled = true;
cb($scope).finally(() => { cb($scope).finally(() => {
element.$ctrl.disabled = false; if (!controller.$oldDisabled)
controller.disabled = false;
}); });
}); });
} }

View File

@ -19,12 +19,16 @@ export function directive($parse) {
const fields = angular.element(elements); const fields = angular.element(elements);
angular.forEach(fields, field => { angular.forEach(fields, field => {
field.$ctrl.disabled = true; const controller = field.$ctrl;
controller.$oldDisabled = controller.disabled;
controller.disabled = true;
}); });
cb($scope).finally(() => { cb($scope).finally(() => {
angular.forEach(fields, field => { angular.forEach(fields, field => {
field.$ctrl.disabled = false; const controller = field.$ctrl;
if (!controller.$oldDisabled)
controller.disabled = false;
}); });
}); });
}); });