You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2018/11/19 16:15:45 UTC
[sling-org-apache-sling-app-cms] 03/04: Setting the background for
the modal and gracefully aborting the Ajax requiest / resetting state when
the background is clicked
This is an automated email from the ASF dual-hosted git repository.
dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git
commit 31ab18b2d8a0a25d5686cb20c0430f76c4d70e58
Author: Dan Klco <dk...@apache.org>
AuthorDate: Mon Nov 19 11:15:27 2018 -0500
Setting the background for the modal and gracefully aborting the Ajax
requiest / resetting state when the background is clicked
---
ui/src/main/frontend/src/js/cms.modal.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ui/src/main/frontend/src/js/cms.modal.js b/ui/src/main/frontend/src/js/cms.modal.js
index ca72de5..862ecc5 100644
--- a/ui/src/main/frontend/src/js/cms.modal.js
+++ b/ui/src/main/frontend/src/js/cms.modal.js
@@ -32,7 +32,7 @@
getModal: function (title, link, button) {
var modal = document.createElement('div');
modal.classList.add('modal');
- modal.innerHTML = '<div class="box"><h3>Loading...</h3><div class="loader is-loading"></div></div>';
+ modal.innerHTML = '<div class="modal-background"></div><div class="modal-content"><div class="box"><h3>Loading...</h3><div class="loader is-loading"></div></div></div>';
document.querySelector('body').appendChild(modal);
var request = new XMLHttpRequest();
@@ -45,6 +45,10 @@
modal.innerHTML = request.responseText;
}
};
+ modal.querySelector('.modal-background').addEventListener('click', function(){
+ request.abort();
+ button.removeAttribute('disabled');
+ });
modal.classList.add('is-active');
request.send();
}