Commit 0d46e75d authored by Michael Iseard's avatar Michael Iseard
Browse files

Simplify message modal handling

parent fdcc047f
import KudosModal from "../../public/KudosModal"
// Handles the messages by showing the modals in order
export function handleMessages(messages) {
let message = new KudosModal(messages[0].id, null,{
onHide: () => {
messages.shift()
if (messages.length) {
message.open()
}
},
})
message.open()
}
\ No newline at end of file
......@@ -4,7 +4,6 @@ import 'jquery-validation'
import '../images/logo-colour-40.png' // used as email attachment
import '../images/logo-colour.svg'
import {getStyle, isVisible} from "../common/helpers/util"
import {handleMessages} from "../common/helpers/modal"
import {
animateInView,
animateProgressBar,
......@@ -141,9 +140,13 @@ jQuery(document).ready(($) => {
// Show message modal if exists.
let messages = document.querySelectorAll('.kudos-message-modal')
if (messages.length) {
handleMessages(Array.from(messages))
Array.from(messages).reverse().forEach(message => {
new KudosModal(message.id).open()
})
}
// Hide honeypot field.
document.querySelectorAll('input[name="donation"]').forEach((e) => {
e.closest('label').classList.add('kd-hidden')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment