view_component_reflex 1.5.0 → 1.6.0
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/README.md +1 -1
- data/app/components/view_component_reflex/component.rb +13 -5
- data/lib/view_component_reflex/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d42e80a31d1a4a27c828f02fc584e9c5eb6660a6d5697e0db3a9631be358dec
|
4
|
+
data.tar.gz: 96450604f1d0965c104171a8b1d667f6d4dc38019e0c6434fd974ff80a3d9f26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deaf8859ae5816796b965ba5c7e1022032253f44fc1e6c94bcdda8dd481d20afb1319a63c99acc98e184908c5c0b299384e1b77cecef4cd5099263bc4f0d4606
|
7
|
+
data.tar.gz: 6da8e3668c5cf6f2dd64c770eada3b381669dd2dac2cf11dc65b2f9e7a94d4e7d450a563506459057642d0f97629d582d1935a9eef7bbf61acfc084402b2e1cd
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ end
|
|
30
30
|
# counter_component.html.erb
|
31
31
|
<%= component_controller do %>
|
32
32
|
<p><%= @count %></p>
|
33
|
-
|
33
|
+
<%= reflex_tag :increment, :button, "Click" %>
|
34
34
|
<% end %>
|
35
35
|
```
|
36
36
|
|
@@ -102,15 +102,23 @@ module ViewComponentReflex
|
|
102
102
|
helpers.controller.instance_variable_get(:@stimulus_reflex)
|
103
103
|
end
|
104
104
|
|
105
|
-
def component_controller(opts = {}, &blk)
|
105
|
+
def component_controller(opts_or_tag = :div, opts = {}, &blk)
|
106
106
|
self.class.init_stimulus_reflex
|
107
107
|
init_key
|
108
|
-
|
108
|
+
|
109
|
+
tag = :div
|
110
|
+
if opts_or_tag.is_a? Hash
|
111
|
+
options = opts_or_tag
|
112
|
+
else
|
113
|
+
tag = opts_or_tag
|
114
|
+
options = opts
|
115
|
+
end
|
116
|
+
options[:data] = {
|
109
117
|
controller: self.class.stimulus_controller,
|
110
118
|
key: key,
|
111
|
-
**(
|
119
|
+
**(options[:data] || {})
|
112
120
|
}
|
113
|
-
content_tag
|
121
|
+
content_tag tag, capture(&blk), options
|
114
122
|
end
|
115
123
|
|
116
124
|
# key is required if you're using state
|
@@ -126,7 +134,7 @@ module ViewComponentReflex
|
|
126
134
|
end
|
127
135
|
|
128
136
|
def reflex_tag(reflex, name, content_or_options_with_block = nil, options = nil, escape = true, &block)
|
129
|
-
action, method = reflex.split("->")
|
137
|
+
action, method = reflex.to_s.split("->")
|
130
138
|
if method.nil?
|
131
139
|
method = action
|
132
140
|
action = "click"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_component_reflex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua LeBlanc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|