katalyst-kpop 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/helpers/kpop_helper.rb +13 -0
- data/lib/katalyst/kpop/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 66c9e1bfc0f87b08a5d2135d9e019a231436caa3e160c0aa650605a2476aa1cf
|
|
4
|
+
data.tar.gz: e14bf1caf937a8c55c5c6e88e2ff94bfa53296bb93023f7ff8de9c23f17068fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5ff8771ff501eceaf9d2bf6aff0cf6da279afbeb93605bc828aaaf4777505c1f624e0dabf84347a167f010288b9c8a79019e1a9d375e828d35da990820253985
|
|
7
|
+
data.tar.gz: ff52b8f6cd986c74cd6873b773bc186d23a3fcc98f501fb65f404bcee45f32b91fa0bb3a55306fbf6c9e63c7100f7de7887b8e9c7a280ddbe2ebe93200a9e02f
|
data/app/helpers/kpop_helper.rb
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module KpopHelper
|
|
4
|
+
# Render a modal dialog. Intended for use inside a kpop turbo frame tag.
|
|
5
|
+
# See builder for options.
|
|
4
6
|
def render_kpop(options = {}, &block)
|
|
5
7
|
Kpop::Modal.new(self).render(options, &block)
|
|
6
8
|
end
|
|
7
9
|
|
|
10
|
+
# Render a turbo stream action that will dismiss any open kpop modals.
|
|
11
|
+
def dismiss_kpop
|
|
12
|
+
turbo_stream.update("kpop", "")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Render a turbo frame tag that can be targeted for rendering kpop modals.
|
|
8
16
|
def kpop_frame_tag(&block)
|
|
9
17
|
turbo_frame_tag "kpop",
|
|
10
18
|
class: "kpop-container",
|
|
@@ -13,6 +21,8 @@ module KpopHelper
|
|
|
13
21
|
end
|
|
14
22
|
end
|
|
15
23
|
|
|
24
|
+
# Renders a link that will navigate the kpop turbo frame to the given URL.
|
|
25
|
+
# The URL should render a modal response inside a kpop frame tag.
|
|
16
26
|
def kpop_link_to(name = nil, options = nil, html_options = nil, &block)
|
|
17
27
|
default_html_options = {
|
|
18
28
|
data: { turbo: true, turbo_frame: "kpop" },
|
|
@@ -25,6 +35,8 @@ module KpopHelper
|
|
|
25
35
|
end
|
|
26
36
|
end
|
|
27
37
|
|
|
38
|
+
# Renders a button that will navigate the kpop turbo frame to the given URL.
|
|
39
|
+
# The URL should render a modal response inside a kpop frame tag.
|
|
28
40
|
def kpop_button_to(name = nil, options = nil, html_options = nil, &block)
|
|
29
41
|
default_html_options = {
|
|
30
42
|
form: { data: { turbo: true, turbo_frame: "kpop" } },
|
|
@@ -32,6 +44,7 @@ module KpopHelper
|
|
|
32
44
|
button_to(name, options, default_html_options.deep_merge(html_options || {}), &block)
|
|
33
45
|
end
|
|
34
46
|
|
|
47
|
+
# Renders a button that will close the current kpop modal, if any.
|
|
35
48
|
def kpop_button_close(content = nil, **options, &block)
|
|
36
49
|
content = block ? capture(yield) : content
|
|
37
50
|
tag.button content, data: { action: "click->kpop#dismiss:prevent" }, **options
|