turbo_power 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -2
- data/Gemfile.lock +177 -46
- data/lib/turbo_power/broadcasts.rb +1 -1
- data/lib/turbo_power/render_helper.rb +28 -0
- data/lib/turbo_power/stream_helper.rb +7 -0
- data/lib/turbo_power/version.rb +1 -1
- data/lib/turbo_power.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c66429633c48026fd0cbafa52235652ec88de59d8261300cd38d7e80b594f105
|
4
|
+
data.tar.gz: cabb958fac7894f6ce872671ef0891447ae447b748a64907fa8be03e65651b61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ac5d5ff43a5af8cfebae2302c63c5accbc547f34d8dd7f5b01103f9de342440ad106a53ca29f54390e315ebc61918b0b506b5cc40d414cb447a403c7da8958a
|
7
|
+
data.tar.gz: 7bf2cf417e1e764ea845c011603438818f89eb19ec1800e22dff1524d7da1827dfa5ff2204e6d5c8126fea44bd10beb5a430b46b3fbef081ca78037c61691494
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,75 +1,193 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
turbo_power (0.
|
4
|
+
turbo_power (0.7.0)
|
5
5
|
turbo-rails (>= 1.3.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
activesupport (= 7.
|
13
|
-
|
10
|
+
actioncable (7.1.3.4)
|
11
|
+
actionpack (= 7.1.3.4)
|
12
|
+
activesupport (= 7.1.3.4)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
zeitwerk (~> 2.6)
|
16
|
+
actionmailbox (7.1.3.4)
|
17
|
+
actionpack (= 7.1.3.4)
|
18
|
+
activejob (= 7.1.3.4)
|
19
|
+
activerecord (= 7.1.3.4)
|
20
|
+
activestorage (= 7.1.3.4)
|
21
|
+
activesupport (= 7.1.3.4)
|
22
|
+
mail (>= 2.7.1)
|
23
|
+
net-imap
|
24
|
+
net-pop
|
25
|
+
net-smtp
|
26
|
+
actionmailer (7.1.3.4)
|
27
|
+
actionpack (= 7.1.3.4)
|
28
|
+
actionview (= 7.1.3.4)
|
29
|
+
activejob (= 7.1.3.4)
|
30
|
+
activesupport (= 7.1.3.4)
|
31
|
+
mail (~> 2.5, >= 2.5.4)
|
32
|
+
net-imap
|
33
|
+
net-pop
|
34
|
+
net-smtp
|
35
|
+
rails-dom-testing (~> 2.2)
|
36
|
+
actionpack (7.1.3.4)
|
37
|
+
actionview (= 7.1.3.4)
|
38
|
+
activesupport (= 7.1.3.4)
|
39
|
+
nokogiri (>= 1.8.5)
|
40
|
+
racc
|
41
|
+
rack (>= 2.2.4)
|
42
|
+
rack-session (>= 1.0.1)
|
14
43
|
rack-test (>= 0.6.3)
|
15
|
-
rails-dom-testing (~> 2.
|
16
|
-
rails-html-sanitizer (~> 1.
|
17
|
-
|
18
|
-
|
44
|
+
rails-dom-testing (~> 2.2)
|
45
|
+
rails-html-sanitizer (~> 1.6)
|
46
|
+
actiontext (7.1.3.4)
|
47
|
+
actionpack (= 7.1.3.4)
|
48
|
+
activerecord (= 7.1.3.4)
|
49
|
+
activestorage (= 7.1.3.4)
|
50
|
+
activesupport (= 7.1.3.4)
|
51
|
+
globalid (>= 0.6.0)
|
52
|
+
nokogiri (>= 1.8.5)
|
53
|
+
actionview (7.1.3.4)
|
54
|
+
activesupport (= 7.1.3.4)
|
19
55
|
builder (~> 3.1)
|
20
|
-
erubi (~> 1.
|
21
|
-
rails-dom-testing (~> 2.
|
22
|
-
rails-html-sanitizer (~> 1.
|
23
|
-
activejob (7.
|
24
|
-
activesupport (= 7.
|
56
|
+
erubi (~> 1.11)
|
57
|
+
rails-dom-testing (~> 2.2)
|
58
|
+
rails-html-sanitizer (~> 1.6)
|
59
|
+
activejob (7.1.3.4)
|
60
|
+
activesupport (= 7.1.3.4)
|
25
61
|
globalid (>= 0.3.6)
|
26
|
-
|
62
|
+
activemodel (7.1.3.4)
|
63
|
+
activesupport (= 7.1.3.4)
|
64
|
+
activerecord (7.1.3.4)
|
65
|
+
activemodel (= 7.1.3.4)
|
66
|
+
activesupport (= 7.1.3.4)
|
67
|
+
timeout (>= 0.4.0)
|
68
|
+
activestorage (7.1.3.4)
|
69
|
+
actionpack (= 7.1.3.4)
|
70
|
+
activejob (= 7.1.3.4)
|
71
|
+
activerecord (= 7.1.3.4)
|
72
|
+
activesupport (= 7.1.3.4)
|
73
|
+
marcel (~> 1.0)
|
74
|
+
activesupport (7.1.3.4)
|
75
|
+
base64
|
76
|
+
bigdecimal
|
27
77
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
78
|
+
connection_pool (>= 2.2.5)
|
79
|
+
drb
|
28
80
|
i18n (>= 1.6, < 2)
|
29
81
|
minitest (>= 5.1)
|
82
|
+
mutex_m
|
30
83
|
tzinfo (~> 2.0)
|
31
84
|
ast (2.4.2)
|
32
|
-
|
33
|
-
|
85
|
+
base64 (0.2.0)
|
86
|
+
bigdecimal (3.1.8)
|
87
|
+
bigdecimal (3.1.8-java)
|
88
|
+
builder (3.3.0)
|
89
|
+
concurrent-ruby (1.3.1)
|
90
|
+
connection_pool (2.4.1)
|
34
91
|
crass (1.0.6)
|
92
|
+
date (3.3.4)
|
93
|
+
date (3.3.4-java)
|
35
94
|
docile (1.4.0)
|
95
|
+
drb (2.2.1)
|
36
96
|
erubi (1.12.0)
|
37
|
-
globalid (1.1
|
38
|
-
activesupport (>=
|
39
|
-
i18n (1.
|
97
|
+
globalid (1.2.1)
|
98
|
+
activesupport (>= 6.1)
|
99
|
+
i18n (1.14.5)
|
40
100
|
concurrent-ruby (~> 1.0)
|
101
|
+
io-console (0.7.2)
|
102
|
+
io-console (0.7.2-java)
|
103
|
+
irb (1.13.1)
|
104
|
+
rdoc (>= 4.0.0)
|
105
|
+
reline (>= 0.4.2)
|
106
|
+
jar-dependencies (0.4.1)
|
41
107
|
json (2.6.3)
|
42
|
-
|
108
|
+
json (2.6.3-java)
|
109
|
+
loofah (2.22.0)
|
43
110
|
crass (~> 1.0.2)
|
44
|
-
nokogiri (>= 1.
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
111
|
+
nokogiri (>= 1.12.0)
|
112
|
+
mail (2.8.1)
|
113
|
+
mini_mime (>= 0.1.1)
|
114
|
+
net-imap
|
115
|
+
net-pop
|
116
|
+
net-smtp
|
117
|
+
marcel (1.0.4)
|
118
|
+
mini_mime (1.1.5)
|
119
|
+
mini_portile2 (2.8.8)
|
120
|
+
minitest (5.23.1)
|
121
|
+
mutex_m (0.2.0)
|
122
|
+
net-imap (0.4.12)
|
123
|
+
date
|
124
|
+
net-protocol
|
125
|
+
net-pop (0.1.2)
|
126
|
+
net-protocol
|
127
|
+
net-protocol (0.2.2)
|
128
|
+
timeout
|
129
|
+
net-smtp (0.5.0)
|
130
|
+
net-protocol
|
131
|
+
nio4r (2.7.3)
|
132
|
+
nio4r (2.7.3-java)
|
133
|
+
nokogiri (1.16.5)
|
134
|
+
mini_portile2 (~> 2.8.2)
|
135
|
+
racc (~> 1.4)
|
136
|
+
nokogiri (1.16.5-x86_64-darwin)
|
50
137
|
racc (~> 1.4)
|
51
138
|
parallel (1.22.1)
|
52
139
|
parser (3.1.3.0)
|
53
140
|
ast (~> 2.4.1)
|
54
|
-
|
55
|
-
|
56
|
-
|
141
|
+
psych (5.1.2)
|
142
|
+
stringio
|
143
|
+
psych (5.1.2-java)
|
144
|
+
jar-dependencies (>= 0.1.7)
|
145
|
+
racc (1.8.0)
|
146
|
+
racc (1.8.0-java)
|
147
|
+
rack (3.0.11)
|
148
|
+
rack-session (2.0.0)
|
149
|
+
rack (>= 3.0.0)
|
150
|
+
rack-test (2.1.0)
|
57
151
|
rack (>= 1.3)
|
58
|
-
|
59
|
-
|
152
|
+
rackup (2.1.0)
|
153
|
+
rack (>= 3)
|
154
|
+
webrick (~> 1.8)
|
155
|
+
rails (7.1.3.4)
|
156
|
+
actioncable (= 7.1.3.4)
|
157
|
+
actionmailbox (= 7.1.3.4)
|
158
|
+
actionmailer (= 7.1.3.4)
|
159
|
+
actionpack (= 7.1.3.4)
|
160
|
+
actiontext (= 7.1.3.4)
|
161
|
+
actionview (= 7.1.3.4)
|
162
|
+
activejob (= 7.1.3.4)
|
163
|
+
activemodel (= 7.1.3.4)
|
164
|
+
activerecord (= 7.1.3.4)
|
165
|
+
activestorage (= 7.1.3.4)
|
166
|
+
activesupport (= 7.1.3.4)
|
167
|
+
bundler (>= 1.15.0)
|
168
|
+
railties (= 7.1.3.4)
|
169
|
+
rails-dom-testing (2.2.0)
|
170
|
+
activesupport (>= 5.0.0)
|
171
|
+
minitest
|
60
172
|
nokogiri (>= 1.6)
|
61
|
-
rails-html-sanitizer (1.
|
62
|
-
loofah (~> 2.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
173
|
+
rails-html-sanitizer (1.6.0)
|
174
|
+
loofah (~> 2.21)
|
175
|
+
nokogiri (~> 1.14)
|
176
|
+
railties (7.1.3.4)
|
177
|
+
actionpack (= 7.1.3.4)
|
178
|
+
activesupport (= 7.1.3.4)
|
179
|
+
irb
|
180
|
+
rackup (>= 1.0.0)
|
67
181
|
rake (>= 12.2)
|
68
|
-
thor (~> 1.0)
|
69
|
-
zeitwerk (~> 2.
|
182
|
+
thor (~> 1.0, >= 1.2.2)
|
183
|
+
zeitwerk (~> 2.6)
|
70
184
|
rainbow (3.1.1)
|
71
|
-
rake (13.
|
185
|
+
rake (13.2.1)
|
186
|
+
rdoc (6.7.0)
|
187
|
+
psych (>= 4.0.0)
|
72
188
|
regexp_parser (2.6.1)
|
189
|
+
reline (0.5.8)
|
190
|
+
io-console (~> 0.5)
|
73
191
|
rexml (3.2.5)
|
74
192
|
rubocop (1.41.1)
|
75
193
|
json (~> 2.3)
|
@@ -97,29 +215,42 @@ GEM
|
|
97
215
|
actionpack (>= 5.2)
|
98
216
|
activesupport (>= 5.2)
|
99
217
|
sprockets (>= 3.0.0)
|
100
|
-
sqlite3 (1.
|
218
|
+
sqlite3 (1.7.3)
|
101
219
|
mini_portile2 (~> 2.8.0)
|
102
|
-
|
103
|
-
|
220
|
+
stringio (3.1.0)
|
221
|
+
thor (1.3.1)
|
222
|
+
timeout (0.4.1)
|
223
|
+
turbo-rails (2.0.5)
|
104
224
|
actionpack (>= 6.0.0)
|
105
225
|
activejob (>= 6.0.0)
|
106
226
|
railties (>= 6.0.0)
|
107
227
|
tzinfo (2.0.6)
|
108
228
|
concurrent-ruby (~> 1.0)
|
109
229
|
unicode-display_width (2.3.0)
|
110
|
-
|
230
|
+
webrick (1.8.1)
|
231
|
+
websocket-driver (0.7.6)
|
232
|
+
websocket-extensions (>= 0.1.0)
|
233
|
+
websocket-driver (0.7.6-java)
|
234
|
+
websocket-extensions (>= 0.1.0)
|
235
|
+
websocket-extensions (0.1.5)
|
236
|
+
zeitwerk (2.6.15)
|
111
237
|
|
112
238
|
PLATFORMS
|
239
|
+
java
|
240
|
+
x64-mingw32
|
241
|
+
x86-mingw32
|
242
|
+
x86-mswin32
|
113
243
|
x86_64-darwin-19
|
114
244
|
x86_64-darwin-22
|
115
245
|
x86_64-darwin-23
|
116
246
|
|
117
247
|
DEPENDENCIES
|
248
|
+
rails
|
118
249
|
rake (~> 13.0)
|
119
250
|
rubocop (~> 1.21)
|
120
251
|
simplecov
|
121
252
|
sprockets-rails
|
122
|
-
sqlite3
|
253
|
+
sqlite3 (~> 1.3)
|
123
254
|
turbo_power!
|
124
255
|
|
125
256
|
BUNDLED WITH
|
@@ -17,7 +17,7 @@ module TurboPower
|
|
17
17
|
def custom_broadcast_action_to(*streamables, action:, **attributes)
|
18
18
|
broadcast_stream_to(
|
19
19
|
*streamables,
|
20
|
-
content:
|
20
|
+
content: RenderHelper.public_send(action, **attributes)
|
21
21
|
)
|
22
22
|
end
|
23
23
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module TurboPower
|
2
|
+
class RenderHelper
|
3
|
+
extend ActionView::Helpers::TagHelper
|
4
|
+
extend TurboPower::StreamHelper
|
5
|
+
|
6
|
+
def self.turbo_stream_action_tag(action, target: nil, targets: nil, template: nil, **attributes)
|
7
|
+
template = action.to_sym.in?(%i[ remove refresh ]) ? "" : tag.template(template.to_s.html_safe)
|
8
|
+
|
9
|
+
if target = convert_to_turbo_stream_dom_id(target)
|
10
|
+
tag.turbo_stream(template, **attributes, action: action, target: target)
|
11
|
+
elsif targets = convert_to_turbo_stream_dom_id(targets, include_selector: true)
|
12
|
+
tag.turbo_stream(template, **attributes, action: action, targets: targets)
|
13
|
+
else
|
14
|
+
tag.turbo_stream(template, **attributes, action: action)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def self.convert_to_turbo_stream_dom_id(target, include_selector: false)
|
21
|
+
if Array(target).any? { |value| value.respond_to?(:to_key) }
|
22
|
+
"#{"#" if include_selector}#{ActionView::RecordIdentifier.dom_id(*target)}"
|
23
|
+
else
|
24
|
+
target
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -113,6 +113,13 @@ module TurboPower
|
|
113
113
|
custom_action_all :toggle_css_class, targets: targets, attributes: attributes.merge(classes: classes)
|
114
114
|
end
|
115
115
|
|
116
|
+
def toggle_attribute(targets = nil, attribute = "", force = "false", **attributes)
|
117
|
+
attribute = attributes[:attribute] || attribute
|
118
|
+
force = attributes[:force] || force
|
119
|
+
|
120
|
+
custom_action_all :toggle_attribute, targets: targets, attributes: attributes.merge(attribute: attribute, force: force)
|
121
|
+
end
|
122
|
+
|
116
123
|
def replace_css_class(targets = nil, from = "", to = "", **attributes)
|
117
124
|
from = attributes[:from] || from
|
118
125
|
to = attributes[:to] || to
|
data/lib/turbo_power/version.rb
CHANGED
data/lib/turbo_power.rb
CHANGED
@@ -6,6 +6,7 @@ require_relative "turbo_power/version"
|
|
6
6
|
require_relative "turbo_power/engine"
|
7
7
|
require_relative "turbo_power/attribute_transformations"
|
8
8
|
require_relative "turbo_power/stream_helper"
|
9
|
+
require_relative "turbo_power/render_helper"
|
9
10
|
require_relative "turbo_power/broadcasts"
|
10
11
|
require_relative "turbo_power/broadcastable"
|
11
12
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo_power
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Roth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: turbo-rails
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/turbo_power/broadcastable.rb
|
46
46
|
- lib/turbo_power/broadcasts.rb
|
47
47
|
- lib/turbo_power/engine.rb
|
48
|
+
- lib/turbo_power/render_helper.rb
|
48
49
|
- lib/turbo_power/stream_helper.rb
|
49
50
|
- lib/turbo_power/version.rb
|
50
51
|
- turbo_power.gemspec
|
@@ -71,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
72
|
- !ruby/object:Gem::Version
|
72
73
|
version: '0'
|
73
74
|
requirements: []
|
74
|
-
rubygems_version: 3.5.
|
75
|
+
rubygems_version: 3.5.9
|
75
76
|
signing_key:
|
76
77
|
specification_version: 4
|
77
78
|
summary: Power-pack for Turbo Streams
|