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

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

View File

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

View File

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