playbook_ui_docs 14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5738 → 14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5754
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78ad68a3a8cb94bf9de6d6caefa6d3918a6d6c469471e4dc32c88802a109feca
|
4
|
+
data.tar.gz: 65febeef99376d292a64ae2f677c65bbca8c9814a939d0d4d1c549347f6ec2dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ace02b69d3058994e0bf8b61569192e963feaf17b0b489b0285864ccb42f2b8580498c1a2d68654555de5e98d096d27e46fc4fc0e53e57bf8c5a26999947c484
|
7
|
+
data.tar.gz: cf1b1991c3ababd471f2bcc3404cd92b215d967ca0a473d2cac65e5b48646f3391b3b401479a6d03efa9215af844bd5c341ae9109f324409c66ab029487f163b
|
@@ -1,5 +1,16 @@
|
|
1
|
+
<%= pb_rails("button", props: { text: "Show Auto Close Toast", variant: "secondary", data: { toast: "#toast-auto-close" } }) %>
|
1
2
|
<%= pb_rails("button", props: { text: "Show Closeable Auto Close Toast", variant: "secondary", data: { toast: "#toast-auto-close-closeable" } }) %>
|
2
3
|
|
4
|
+
<%= pb_rails("fixed_confirmation_toast", props: {
|
5
|
+
auto_close: 3000,
|
6
|
+
classname: "toast-to-hide",
|
7
|
+
id: "toast-auto-close",
|
8
|
+
text: "I will disappear in 3 seconds.",
|
9
|
+
status: "tip",
|
10
|
+
vertical: "top",
|
11
|
+
horizontal: "center"
|
12
|
+
}) %>
|
13
|
+
|
3
14
|
<%= pb_rails("fixed_confirmation_toast", props: {
|
4
15
|
auto_close: 10000,
|
5
16
|
closeable: true,
|
@@ -11,23 +22,37 @@
|
|
11
22
|
}) %>
|
12
23
|
|
13
24
|
<script>
|
14
|
-
|
15
|
-
|
16
|
-
|
25
|
+
document.addEventListener('DOMContentLoaded', () => {
|
26
|
+
// Initialize toast elements and buttons
|
27
|
+
const toasts = {
|
28
|
+
'#toast-auto-close': document.querySelector("#toast-auto-close"),
|
29
|
+
'#toast-auto-close-closeable': document.querySelector("#toast-auto-close-closeable")
|
30
|
+
}
|
31
|
+
|
32
|
+
const buttons = {
|
33
|
+
'#toast-auto-close': document.querySelector("button[data-toast='#toast-auto-close']"),
|
34
|
+
'#toast-auto-close-closeable': document.querySelector("button[data-toast='#toast-auto-close-closeable']")
|
35
|
+
}
|
17
36
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
37
|
+
// Store original toasts and remove them from DOM
|
38
|
+
const originalToasts = {}
|
39
|
+
Object.entries(toasts).forEach(([id, toast]) => {
|
40
|
+
if (toast) {
|
41
|
+
originalToasts[id] = toast.cloneNode(true)
|
42
|
+
toast.remove()
|
22
43
|
}
|
44
|
+
})
|
23
45
|
|
24
|
-
|
25
|
-
|
26
|
-
|
46
|
+
// Set up button click handlers
|
47
|
+
Object.keys(buttons).forEach((toastId) => {
|
48
|
+
const button = buttons[toastId]
|
49
|
+
if (button) {
|
50
|
+
button.onclick = () => {
|
51
|
+
const newToast = originalToasts[toastId].cloneNode(true)
|
27
52
|
newToast.style.display = "flex"
|
28
|
-
|
29
53
|
document.body.appendChild(newToast)
|
30
54
|
}
|
31
55
|
}
|
32
56
|
})
|
57
|
+
})
|
33
58
|
</script>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui_docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.12.0.pre.alpha.
|
4
|
+
version: 14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5754
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|