diff --git a/src/javascript/app/common/attach_dom/dialog.js b/src/javascript/app/common/attach_dom/dialog.js index b338e96d7dd..9be84f97d3d 100644 --- a/src/javascript/app/common/attach_dom/dialog.js +++ b/src/javascript/app/common/attach_dom/dialog.js @@ -1,6 +1,5 @@ const showPopup = require('./popup'); const elementInnerHtml = require('../../../_common/common_functions').elementInnerHtml; -const urlFor = require('../../../_common/url').urlFor; // use this function if you need a simple popup with just a confirm or also a cancel button // if you need to show a form with some validations, use showPopup() instead @@ -8,7 +7,8 @@ const Dialog = (() => { const baseDialog = (options, is_alert = false) => ( new Promise((resolve) => { showPopup({ - url : urlFor('dialog'), + // url : urlFor('dialog'), // Unused in pages.js. + // TODO: Uncomment/update popup logic when restoring Dialog feature. popup_id : options.id, form_id : '#frm_confirm', content_id : '#dialog_content', diff --git a/src/javascript/app/common/attach_dom/popup.js b/src/javascript/app/common/attach_dom/popup.js index 4e51d2470ae..4d7f7508694 100644 --- a/src/javascript/app/common/attach_dom/popup.js +++ b/src/javascript/app/common/attach_dom/popup.js @@ -15,7 +15,7 @@ const showPopup = (options) => { } if (cache[options.url]) { callback(options); - } else { + } else if (options.url) { const xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState !== 4 || this.status !== 200) { @@ -32,7 +32,9 @@ const showPopup = (options) => { const callback = (options) => { const div = createElement('div', { html: cache[options.url] }); const lightbox = createElement('div', { id: options.popup_id, class: 'lightbox' }); - lightbox.appendChild(div.querySelector(options.content_id)); + const content = div.querySelector(options.content_id); + if (!content) return; + lightbox.appendChild(content); lightbox.addEventListener('DOMNodeRemoved', (e) => { if (!popup_queue.length || e.target.className !== 'lightbox') return; document.body.appendChild(popup_queue.pop()); // show popup in queue diff --git a/src/javascript/app/pages/user/account/top_up_virtual/pop_up.js b/src/javascript/app/pages/user/account/top_up_virtual/pop_up.js index 6613fc6113a..a2fc136e720 100644 --- a/src/javascript/app/pages/user/account/top_up_virtual/pop_up.js +++ b/src/javascript/app/pages/user/account/top_up_virtual/pop_up.js @@ -68,7 +68,8 @@ const TopUpVirtualPopup = (() => { showPopup({ form_id, popup_id, - url : urlFor('user/top_up_virtual_pop_up'), + // url : urlFor('user/top_up_virtual_pop_up'), // Unused in pages.js. + // TODO: Uncomment/update popup logic when restoring TopUpVirtualPopup. Removed JSX can be found in PR#592 (4f8e0ff) content_id : '#top_up', additionalFunction: () => { if (message) {