FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
roadmap/app/javascript/src/utils/notificationHelper.js at api-patch · DMPRoadmap/roadmap · GitHub
DMPRoadmap
roadmap
Repository navigation
Code
Issues
300
(300)
Pull requests
49
(49)
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
roadmap
/
app
/
javascript
/
src
/
utils
/
notificationHelper.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (48 loc) · 1.43 KB
Breadcrumbs
roadmap
/
app
/
javascript
/
src
/
utils
/
notificationHelper.js
Copy path
File metadata and controls
58 lines (48 loc) · 1.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import
{
isString
,
isObject
}
from
'./isType'
;
/*
Helpers that will display the specified message in in the notification
area at the top of the page
*/
export
function
hideNotifications
(
)
{
$
(
'#notification-area'
)
.
addClass
(
'hide'
)
.
removeClass
(
'notification-area--floating'
)
;
}
function
renderMessage
(
options
=
{
}
)
{
const
notificationArea
=
$
(
'#notification-area'
)
;
if
(
isString
(
options
.
message
)
&&
isObject
(
notificationArea
)
)
{
notificationArea
.
removeClass
(
'alert-info'
,
'alert-warning'
)
.
addClass
(
options
.
className
)
;
if
(
options
.
floating
)
{
notificationArea
.
addClass
(
'notification-area--floating'
)
;
}
notificationArea
.
find
(
'i, span'
)
.
remove
(
)
;
notificationArea
.
append
(
`
<i class="fas fa-
${
options
.
icon
}
" aria-hidden="true"></i>
<span>
${
options
.
message
}
</span>
`
)
;
notificationArea
.
removeClass
(
'hide'
)
;
if
(
options
.
autoDismiss
)
{
setTimeout
(
(
)
=>
{
hideNotifications
(
)
;
}
,
5000
)
;
}
}
}
export
function
renderNotice
(
msg
,
options
=
{
}
)
{
renderMessage
(
{
message
:
msg
,
icon
:
'circle-check'
,
className
:
'alert-info'
,
floating
:
options
.
floating
===
true
,
autoDismiss
:
options
.
autoDismiss
===
true
,
}
)
;
}
export
function
renderAlert
(
msg
,
options
=
{
}
)
{
renderMessage
(
{
message
:
msg
,
icon
:
'circle-xmark'
,
className
:
'alert-warning'
,
floating
:
options
.
floating
===
true
,
autoDismiss
:
options
.
autoDismiss
===
true
,
}
)
;
}
Back
|
FazBrowse Home
|
New Git URL