view_component_reflex 3.0.5 → 3.0.6.pre

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: 0c063a5b69263cf48e6a92937e65a73cd1a2c5e00577734f62b7cbf6186604d3
4
- data.tar.gz: 26ec1a060c0283a906df2bcda4cd11110bb31ebe69e9d5c741cf568d6dabd7de
3
+ metadata.gz: 06620c8b6be4659144cd0ea4db2ab86ee8c8be865e38cb9d314ba025e52568c3
4
+ data.tar.gz: 036046d3b8bac3515b77508938a2b8891a60c00fac2b7eb5395ddf682a8747f7
5
5
  SHA512:
6
- metadata.gz: b7f55e4e85f42a9c9b0044710f8f2c295e0c13350bfc26f1c940626b581e68a851feb1c7cf4c54124a7e96ac9ade6565b1e3361f789e0efbc16644c78bc906b2
7
- data.tar.gz: aa24fa075eae92847e04931a1278b20358472fc9fdb00079bb1f0b774d84f5a3a047f90d61e42295a578999a7c69ec12e152847d77ecf6a4236554d4b4c38605
6
+ metadata.gz: 98253c5ec035f9d226024aa12615a4fdaf4c285baa6cbadf69e3b0535aa50452680ebf43701126d014209540f2a2b01136e59cdad21afc55c95063cb7bbfa213
7
+ data.tar.gz: 6278bbcb0461e0a61081bba05240596bcda35a8c10c606613b4ad74c3022bb4260b21c88d80924f590baeb9f52c035d6245efbb7ec18049e9cfd6c49bf03ab8f
@@ -24,16 +24,7 @@ module ViewComponentReflex
24
24
  html: html.inner_html,
25
25
  children_only: true,
26
26
  permanent_attribute_name: "data-reflex-permanent",
27
- stimulus_reflex: {
28
- reflex_id: reflex_id,
29
- xpath: xpath,
30
- c_xpath: c_xpath,
31
- target: target,
32
- reflex_controller: reflex_controller,
33
- url: url,
34
- morph: :page,
35
- attrs: {key: element.dataset[:key]}
36
- }
27
+ stimulus_reflex: stimulus_reflex_data
37
28
  )
38
29
  end
39
30
  end
@@ -55,19 +46,25 @@ module ViewComponentReflex
55
46
  children_only: true,
56
47
  html: document.css(selector).inner_html,
57
48
  permanent_attribute_name: "data-reflex-permanent",
58
- stimulus_reflex: {
59
- reflex_id: reflex_id,
60
- xpath: xpath,
61
- target: target,
62
- c_xpath: c_xpath,
63
- reflex_controller: reflex_controller,
64
- url: url,
65
- morph: :page,
66
- attrs: {key: element.dataset[:key]}
67
- }
49
+ stimulus_reflex: stimulus_reflex_data
68
50
  )
69
51
  end
70
52
 
53
+ def stimulus_reflex_data
54
+ {
55
+ reflex_id: reflex_id,
56
+ xpath: xpath,
57
+ target: target,
58
+ c_xpath: c_xpath,
59
+ reflex_controller: reflex_controller,
60
+ url: url,
61
+ morph: :page,
62
+ attrs: {
63
+ key: element.dataset[:key]
64
+ }
65
+ }
66
+ end
67
+
71
68
  def target
72
69
  "#{component_class}##{method_name}"
73
70
  end
@@ -127,15 +124,20 @@ module ViewComponentReflex
127
124
  end
128
125
 
129
126
  def stimulate(target, data)
130
- dataset = {}
131
- data.each do |k, v|
132
- dataset["data-#{k}"] = v.to_s
127
+ data_to_receive = {}
128
+
129
+ stimulus_reflex_data.each do |k, v|
130
+ data_to_receive[k.to_s.camelize(:lower)] = v
133
131
  end
134
- channel.receive({
135
- "target" => target,
136
- "attrs" => element.attributes.to_h.symbolize_keys,
137
- "dataset" => dataset
138
- })
132
+
133
+ data_to_receive["dataset"] = data.each_with_object({}) do |(k, v), o|
134
+ o["data-#{k}"] = v
135
+ end
136
+
137
+ data_to_receive["attrs"] = element.attributes.to_h.symbolize_keys
138
+ data_to_receive["target"] = target
139
+
140
+ channel.receive data_to_receive
139
141
  end
140
142
 
141
143
  def component
@@ -1,3 +1,3 @@
1
1
  module ViewComponentReflex
2
- VERSION = '3.0.5'
2
+ VERSION = '3.0.6.pre'
3
3
  end
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: 3.0.5
4
+ version: 3.0.6.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua LeBlanc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-04 00:00:00.000000000 Z
11
+ date: 2021-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,9 +108,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - ">="
111
+ - - ">"
112
112
  - !ruby/object:Gem::Version
113
- version: '0'
113
+ version: 1.3.1
114
114
  requirements: []
115
115
  rubygems_version: 3.0.3
116
116
  signing_key: