diff --git a/app/assets/javascripts/utilities/showLoginModal.js b/app/assets/javascripts/utilities/showLoginModal.js index cb8d04816..a667c0b9c 100644 --- a/app/assets/javascripts/utilities/showLoginModal.js +++ b/app/assets/javascripts/utilities/showLoginModal.js @@ -1,5 +1,5 @@ function showLoginModal() { - window.showModal({ + window.Forem.showModal({ title: 'Log in to continue', contentSelector: '#global-signup-modal', overlay: true, diff --git a/app/assets/javascripts/utilities/showUserAlertModal.js b/app/assets/javascripts/utilities/showUserAlertModal.js index 355dc9b20..00ba187cd 100644 --- a/app/assets/javascripts/utilities/showUserAlertModal.js +++ b/app/assets/javascripts/utilities/showUserAlertModal.js @@ -1,3 +1,12 @@ +/** + * HTML ID for modal DOM node + * + * @private + * @constant modalId * + * @type {string} + */ +const modalId = 'user-alert-modal'; + /** * Displays a general purpose user alert modal with a title, body text, and confirmation button. * @@ -10,8 +19,12 @@ * showUserAlertModal('Warning', 'You must wait', 'OK', '/faq/why-must-i-wait', 'Why must I wait?'); */ function showUserAlertModal(title, text, confirm_text) { - let modalDiv = buildModalDiv(title, text, confirm_text); - toggleUserAlertModal(); + buildModalDiv(text, confirm_text); + window.Forem.showModal({ + title, + contentSelector: `#${modalId}`, + overlay: true, + }); } /** * Displays a user rate limit alert modal letting the user know what they did that exceeded a rate limit, @@ -36,60 +49,27 @@ function showRateLimitModal(action_text, next_action_text) { ); } -/** - * HTML ID for modal DOM node - * - * @private - * @constant modalId * - * @type {string} - */ -const modalId = 'user-alert-modal'; - /** * HTML template for modal * * @private * @function getModalHtml * - * @param {string} title The title/heading text to be displayed * @param {string} text The body text to be displayed * @param {string} confirm_text Text of the confirmation button * * @returns {string} HTML for the modal */ -const getModalHtml = ( - title, - text, - confirm_text, -) => `