Prevent clicks outside of prompt modal from closing the modal without saving. User will now need to explicity hit the X or Cancel buttons to close the modal prematurely.

This commit is contained in:
mabashian 2019-07-30 15:22:01 -04:00
parent 6499f2b233
commit 47c59d5211
2 changed files with 11 additions and 4 deletions

View File

@ -33,18 +33,23 @@ function AtModalController ($timeout, eventService, strings) {
vm.modal.title = title;
vm.modal.message = message;
listeners = eventService.addListeners([
[overlay, 'click', vm.clickToHide]
]);
if (!vm.modal.preventOutsideClick) {
listeners = eventService.addListeners([
[overlay, 'click', vm.clickToHide]
]);
}
overlay.style.display = 'block';
overlay.style.opacity = 1;
};
vm.hide = () => {
console.log('hide');
overlay.style.opacity = 0;
eventService.remove(listeners);
if (!vm.modal.preventOutsideClick) {
eventService.remove(listeners);
}
setTimeout(() => {
overlay.style.display = 'none';

View File

@ -13,6 +13,8 @@ export default [ 'ProcessErrors', 'CredentialTypeModel', 'TemplatesStrings', '$f
scope = _scope_;
({ modal } = scope[scope.ns]);
modal.preventOutsideClick = true;
scope.$watch('vm.promptData.triggerModalOpen', () => {
vm.actionButtonClicked = false;
if(vm.promptData && vm.promptData.triggerModalOpen) {