mirror of
https://github.com/ansible/awx.git
synced 2026-01-18 21:21:21 -03:30
Merge pull request #4398 from mabashian/3644-launch-outside-click
Prevent clicks outside of prompt modal from closing the modal without saving Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
commit
416b2ef37a
@ -1,30 +1,7 @@
|
||||
const templateUrl = require('~components/dialog/dialog.partial.html');
|
||||
|
||||
const overlayClass = 'at-Dialog';
|
||||
|
||||
function DialogController () {
|
||||
const vm = this || {};
|
||||
|
||||
vm.handleClick = ({ target }) => {
|
||||
if (!vm.onClose) {
|
||||
return;
|
||||
}
|
||||
|
||||
const targetElement = $(target);
|
||||
|
||||
if (targetElement.hasClass(overlayClass)) {
|
||||
vm.onClose();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
DialogController.$inject = [
|
||||
'$element',
|
||||
];
|
||||
|
||||
export default {
|
||||
templateUrl,
|
||||
controller: DialogController,
|
||||
controllerAs: 'vm',
|
||||
transclude: true,
|
||||
bindings: {
|
||||
|
||||
@ -12,11 +12,10 @@ function atModalLink (scope, el, attrs, controllers) {
|
||||
});
|
||||
}
|
||||
|
||||
function AtModalController ($timeout, eventService, strings) {
|
||||
function AtModalController (strings) {
|
||||
const vm = this;
|
||||
|
||||
let overlay;
|
||||
let listeners;
|
||||
|
||||
vm.strings = strings;
|
||||
|
||||
@ -33,10 +32,6 @@ function AtModalController ($timeout, eventService, strings) {
|
||||
vm.modal.title = title;
|
||||
vm.modal.message = message;
|
||||
|
||||
listeners = eventService.addListeners([
|
||||
[overlay, 'click', vm.clickToHide]
|
||||
]);
|
||||
|
||||
overlay.style.display = 'block';
|
||||
overlay.style.opacity = 1;
|
||||
};
|
||||
@ -44,8 +39,6 @@ function AtModalController ($timeout, eventService, strings) {
|
||||
vm.hide = () => {
|
||||
overlay.style.opacity = 0;
|
||||
|
||||
eventService.remove(listeners);
|
||||
|
||||
setTimeout(() => {
|
||||
overlay.style.display = 'none';
|
||||
}, DEFAULT_ANIMATION_DURATION);
|
||||
@ -63,8 +56,6 @@ function AtModalController ($timeout, eventService, strings) {
|
||||
}
|
||||
|
||||
AtModalController.$inject = [
|
||||
'$timeout',
|
||||
'EventService',
|
||||
'ComponentsStrings'
|
||||
];
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user