hotfix #2135 - Don't enable inputs disabled by ACL directive
gitea/salix/2135-hotfix_acl_disabled_input This commit looks good
Details
gitea/salix/2135-hotfix_acl_disabled_input This commit looks good
Details
This commit is contained in:
parent
a03788317b
commit
5e1f31ebdd
|
@ -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'];
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue