Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michael Iseard
Kudos-Donations
Commits
0d46e75d
Commit
0d46e75d
authored
Oct 12, 2021
by
Michael Iseard
Browse files
Simplify message modal handling
parent
fdcc047f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/common/helpers/modal.js
deleted
100644 → 0
View file @
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
src/public/kudos-public.js
View file @
0d46e75d
...
...
@@ -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
'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment