turbo_power 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -3
- data/Gemfile.lock +63 -77
- data/README.md +14 -1
- data/Rakefile +1 -1
- data/lib/turbo_power/engine.rb +5 -0
- data/lib/turbo_power/stream_helper.rb +63 -43
- data/lib/turbo_power/version.rb +1 -1
- data/lib/turbo_power.rb +3 -2
- data/test/test_helper.rb +1 -1
- data/test/turbo_power/stream_helper_test.rb +11 -0
- data/test/{test_turbo_power.rb → turbo_power_test.rb} +0 -0
- data/turbo_power.gemspec +2 -2
- metadata +12 -11
- data/app/helpers/turbo_power/streams/action_helper.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c9df9b4805eb75df7767c66ca573d21ef4bcd94203f19cc7be3982aa2a55e5f
|
4
|
+
data.tar.gz: d343c3de805f702633fe5dfc8935bee4117e935bb2d604ff651fe5cf46736fb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd57269d083dda4a54dc1aba8dea27fd967c98a8c7aae31661178645cd97bc89a3a86b15b4140a73057a2181e77e53db2d21a236a88047990bb109515bf3ae87
|
7
|
+
data.tar.gz: eb2d9e17097ceb48da7f11caf084073c062787f198d38d04994124c245ed2466ceacc5ca377db584539993ba10829e7481835190ba7037a9177d6a4e42b9a426
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,93 +1,74 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/marcoroth/turbo-rails.git
|
3
|
-
revision: ba0c355b74441778f35b58608e2baafc6c0b3c46
|
4
|
-
branch: custom-action-helpers
|
5
|
-
specs:
|
6
|
-
turbo-rails (1.1.1)
|
7
|
-
actionpack (>= 6.0.0)
|
8
|
-
activejob (>= 6.0.0)
|
9
|
-
railties (>= 6.0.0)
|
10
|
-
|
11
|
-
GIT
|
12
|
-
remote: https://github.com/marcoroth/turbo_ready.git
|
13
|
-
revision: ccd0ceb7a1209501f60591c833aba2a150d46066
|
14
|
-
branch: main
|
15
|
-
specs:
|
16
|
-
turbo_ready (0.0.5)
|
17
|
-
rails (>= 6.1)
|
18
|
-
turbo-rails (>= 1.1)
|
19
|
-
|
20
1
|
PATH
|
21
2
|
remote: .
|
22
3
|
specs:
|
23
|
-
turbo_power (0.1.
|
24
|
-
turbo-rails
|
4
|
+
turbo_power (0.1.2)
|
5
|
+
turbo-rails (~> 1.3.0)
|
25
6
|
turbo_ready
|
26
7
|
|
27
8
|
GEM
|
28
9
|
remote: https://rubygems.org/
|
29
10
|
specs:
|
30
|
-
actioncable (7.0.
|
31
|
-
actionpack (= 7.0.
|
32
|
-
activesupport (= 7.0.
|
11
|
+
actioncable (7.0.4)
|
12
|
+
actionpack (= 7.0.4)
|
13
|
+
activesupport (= 7.0.4)
|
33
14
|
nio4r (~> 2.0)
|
34
15
|
websocket-driver (>= 0.6.1)
|
35
|
-
actionmailbox (7.0.
|
36
|
-
actionpack (= 7.0.
|
37
|
-
activejob (= 7.0.
|
38
|
-
activerecord (= 7.0.
|
39
|
-
activestorage (= 7.0.
|
40
|
-
activesupport (= 7.0.
|
16
|
+
actionmailbox (7.0.4)
|
17
|
+
actionpack (= 7.0.4)
|
18
|
+
activejob (= 7.0.4)
|
19
|
+
activerecord (= 7.0.4)
|
20
|
+
activestorage (= 7.0.4)
|
21
|
+
activesupport (= 7.0.4)
|
41
22
|
mail (>= 2.7.1)
|
42
23
|
net-imap
|
43
24
|
net-pop
|
44
25
|
net-smtp
|
45
|
-
actionmailer (7.0.
|
46
|
-
actionpack (= 7.0.
|
47
|
-
actionview (= 7.0.
|
48
|
-
activejob (= 7.0.
|
49
|
-
activesupport (= 7.0.
|
26
|
+
actionmailer (7.0.4)
|
27
|
+
actionpack (= 7.0.4)
|
28
|
+
actionview (= 7.0.4)
|
29
|
+
activejob (= 7.0.4)
|
30
|
+
activesupport (= 7.0.4)
|
50
31
|
mail (~> 2.5, >= 2.5.4)
|
51
32
|
net-imap
|
52
33
|
net-pop
|
53
34
|
net-smtp
|
54
35
|
rails-dom-testing (~> 2.0)
|
55
|
-
actionpack (7.0.
|
56
|
-
actionview (= 7.0.
|
57
|
-
activesupport (= 7.0.
|
36
|
+
actionpack (7.0.4)
|
37
|
+
actionview (= 7.0.4)
|
38
|
+
activesupport (= 7.0.4)
|
58
39
|
rack (~> 2.0, >= 2.2.0)
|
59
40
|
rack-test (>= 0.6.3)
|
60
41
|
rails-dom-testing (~> 2.0)
|
61
42
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
62
|
-
actiontext (7.0.
|
63
|
-
actionpack (= 7.0.
|
64
|
-
activerecord (= 7.0.
|
65
|
-
activestorage (= 7.0.
|
66
|
-
activesupport (= 7.0.
|
43
|
+
actiontext (7.0.4)
|
44
|
+
actionpack (= 7.0.4)
|
45
|
+
activerecord (= 7.0.4)
|
46
|
+
activestorage (= 7.0.4)
|
47
|
+
activesupport (= 7.0.4)
|
67
48
|
globalid (>= 0.6.0)
|
68
49
|
nokogiri (>= 1.8.5)
|
69
|
-
actionview (7.0.
|
70
|
-
activesupport (= 7.0.
|
50
|
+
actionview (7.0.4)
|
51
|
+
activesupport (= 7.0.4)
|
71
52
|
builder (~> 3.1)
|
72
53
|
erubi (~> 1.4)
|
73
54
|
rails-dom-testing (~> 2.0)
|
74
55
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
75
|
-
activejob (7.0.
|
76
|
-
activesupport (= 7.0.
|
56
|
+
activejob (7.0.4)
|
57
|
+
activesupport (= 7.0.4)
|
77
58
|
globalid (>= 0.3.6)
|
78
|
-
activemodel (7.0.
|
79
|
-
activesupport (= 7.0.
|
80
|
-
activerecord (7.0.
|
81
|
-
activemodel (= 7.0.
|
82
|
-
activesupport (= 7.0.
|
83
|
-
activestorage (7.0.
|
84
|
-
actionpack (= 7.0.
|
85
|
-
activejob (= 7.0.
|
86
|
-
activerecord (= 7.0.
|
87
|
-
activesupport (= 7.0.
|
59
|
+
activemodel (7.0.4)
|
60
|
+
activesupport (= 7.0.4)
|
61
|
+
activerecord (7.0.4)
|
62
|
+
activemodel (= 7.0.4)
|
63
|
+
activesupport (= 7.0.4)
|
64
|
+
activestorage (7.0.4)
|
65
|
+
actionpack (= 7.0.4)
|
66
|
+
activejob (= 7.0.4)
|
67
|
+
activerecord (= 7.0.4)
|
68
|
+
activesupport (= 7.0.4)
|
88
69
|
marcel (~> 1.0)
|
89
70
|
mini_mime (>= 1.1.0)
|
90
|
-
activesupport (7.0.
|
71
|
+
activesupport (7.0.4)
|
91
72
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
92
73
|
i18n (>= 1.6, < 2)
|
93
74
|
minitest (>= 5.1)
|
@@ -103,7 +84,7 @@ GEM
|
|
103
84
|
i18n (1.12.0)
|
104
85
|
concurrent-ruby (~> 1.0)
|
105
86
|
json (2.6.2)
|
106
|
-
loofah (2.
|
87
|
+
loofah (2.19.0)
|
107
88
|
crass (~> 1.0.2)
|
108
89
|
nokogiri (>= 1.5.9)
|
109
90
|
mail (2.7.1)
|
@@ -136,28 +117,28 @@ GEM
|
|
136
117
|
rack (2.2.4)
|
137
118
|
rack-test (2.0.2)
|
138
119
|
rack (>= 1.3)
|
139
|
-
rails (7.0.
|
140
|
-
actioncable (= 7.0.
|
141
|
-
actionmailbox (= 7.0.
|
142
|
-
actionmailer (= 7.0.
|
143
|
-
actionpack (= 7.0.
|
144
|
-
actiontext (= 7.0.
|
145
|
-
actionview (= 7.0.
|
146
|
-
activejob (= 7.0.
|
147
|
-
activemodel (= 7.0.
|
148
|
-
activerecord (= 7.0.
|
149
|
-
activestorage (= 7.0.
|
150
|
-
activesupport (= 7.0.
|
120
|
+
rails (7.0.4)
|
121
|
+
actioncable (= 7.0.4)
|
122
|
+
actionmailbox (= 7.0.4)
|
123
|
+
actionmailer (= 7.0.4)
|
124
|
+
actionpack (= 7.0.4)
|
125
|
+
actiontext (= 7.0.4)
|
126
|
+
actionview (= 7.0.4)
|
127
|
+
activejob (= 7.0.4)
|
128
|
+
activemodel (= 7.0.4)
|
129
|
+
activerecord (= 7.0.4)
|
130
|
+
activestorage (= 7.0.4)
|
131
|
+
activesupport (= 7.0.4)
|
151
132
|
bundler (>= 1.15.0)
|
152
|
-
railties (= 7.0.
|
133
|
+
railties (= 7.0.4)
|
153
134
|
rails-dom-testing (2.0.3)
|
154
135
|
activesupport (>= 4.2.0)
|
155
136
|
nokogiri (>= 1.6)
|
156
137
|
rails-html-sanitizer (1.4.3)
|
157
138
|
loofah (~> 2.3)
|
158
|
-
railties (7.0.
|
159
|
-
actionpack (= 7.0.
|
160
|
-
activesupport (= 7.0.
|
139
|
+
railties (7.0.4)
|
140
|
+
actionpack (= 7.0.4)
|
141
|
+
activesupport (= 7.0.4)
|
161
142
|
method_source
|
162
143
|
rake (>= 12.2)
|
163
144
|
thor (~> 1.0)
|
@@ -182,6 +163,13 @@ GEM
|
|
182
163
|
strscan (3.0.4)
|
183
164
|
thor (1.2.1)
|
184
165
|
timeout (0.3.0)
|
166
|
+
turbo-rails (1.3.0)
|
167
|
+
actionpack (>= 6.0.0)
|
168
|
+
activejob (>= 6.0.0)
|
169
|
+
railties (>= 6.0.0)
|
170
|
+
turbo_ready (0.1.0)
|
171
|
+
rails (>= 6.1)
|
172
|
+
turbo-rails (>= 1.1)
|
185
173
|
tzinfo (2.0.5)
|
186
174
|
concurrent-ruby (~> 1.0)
|
187
175
|
unicode-display_width (2.2.0)
|
@@ -197,9 +185,7 @@ DEPENDENCIES
|
|
197
185
|
minitest (~> 5.0)
|
198
186
|
rake (~> 13.0)
|
199
187
|
rubocop (~> 1.21)
|
200
|
-
turbo-rails!
|
201
188
|
turbo_power!
|
202
|
-
turbo_ready!
|
203
189
|
|
204
190
|
BUNDLED WITH
|
205
191
|
2.3.19
|
data/README.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# TurboPower Rails
|
2
2
|
|
3
|
-
|
3
|
+
TurboPower Rails is a power-pack for Turbo Streams. This gem provides server-side Ruby helpers for the NPM package [`turbo_power`](https://github.com/marcoroth/turbo_power).
|
4
|
+
|
5
|
+
## Important Note
|
6
|
+
|
7
|
+
This is very much a work in progress right now. This requires the NPM package `@hotwired/turbo >= 7.2.0` or `@hotwired/turbo-rails >= 7.2.0` and the gem `turbo-rails >= 1.3.0`.
|
8
|
+
|
9
|
+
**Also:** I can't guarantee that the current API stays that way, there might be even more ways to improve it.
|
10
|
+
|
4
11
|
|
5
12
|
## Installation
|
6
13
|
|
@@ -87,6 +94,7 @@ import * as Turbo from '@hotwired/turbo'
|
|
87
94
|
* `turbo_stream.set_cookie(cookie, **attributes)`
|
88
95
|
* `turbo_stream.set_cookie_item(key, value, **attributes)`
|
89
96
|
* `turbo_stream.set_focus(target, **attributes)`
|
97
|
+
* `turbo_stream.set_title(title, **attributes)`
|
90
98
|
|
91
99
|
|
92
100
|
### Browser History Actions
|
@@ -105,6 +113,11 @@ import * as Turbo from '@hotwired/turbo'
|
|
105
113
|
|
106
114
|
* `turbo_stream.notification(title, options, **attributes)`
|
107
115
|
|
116
|
+
### Turbo Frame Actions
|
117
|
+
|
118
|
+
* `turbo_stream.reload_turbo_frame(frame_id, **attributes)`
|
119
|
+
* `turbo_stream.set_turbo_frame_src(frame_id, src, **attributes)`
|
120
|
+
|
108
121
|
## Development
|
109
122
|
|
110
123
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
data/lib/turbo_power/engine.rb
CHANGED
@@ -1,93 +1,106 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module TurboPower
|
4
4
|
module StreamHelper
|
5
|
+
# Custom Action Helpers
|
6
|
+
|
7
|
+
## Also see:
|
8
|
+
## => https://github.com/hotwired/turbo-rails/pull/374
|
9
|
+
|
10
|
+
def custom_action(name, target: nil, content: nil, allow_inferred_rendering: true, attributes: {}, **rendering, &block)
|
11
|
+
template = render_template(target, content, allow_inferred_rendering: allow_inferred_rendering, **rendering, &block)
|
12
|
+
|
13
|
+
turbo_stream_action_tag name, target: target, template: template, **attributes
|
14
|
+
end
|
15
|
+
|
16
|
+
def custom_action_all(name, targets: nil, content: nil, allow_inferred_rendering: true, attributes: {}, **rendering, &block)
|
17
|
+
template = render_template(targets, content, allow_inferred_rendering: allow_inferred_rendering, **rendering, &block)
|
18
|
+
|
19
|
+
turbo_stream_action_tag name, targets: targets, template: template, **attributes
|
20
|
+
end
|
5
21
|
|
6
22
|
# DOM Actions
|
7
23
|
|
8
24
|
def graft(target, parent, **attributes)
|
9
|
-
|
25
|
+
custom_action_all :graft, targets: target, attributes: attributes.merge(parent: parent)
|
10
26
|
end
|
11
27
|
|
12
28
|
def inner_html(target, html = nil, **attributes, &block)
|
13
|
-
|
29
|
+
custom_action_all :inner_html, targets: target, content: html, attributes: attributes, &block
|
14
30
|
end
|
15
31
|
|
16
32
|
def insert_adjacent_html(target, html = nil, position: 'beforeend', **attributes, &block)
|
17
|
-
|
33
|
+
custom_action_all :insert_adjacent_html, targets: target, content: html, attributes: attributes.merge(position: position), &block
|
18
34
|
end
|
19
35
|
|
20
36
|
def insert_adjacent_text(target, text, position: 'beforebegin', **attributes)
|
21
|
-
|
37
|
+
custom_action_all :insert_adjacent_text, targets: target, content: "", attributes: attributes.merge(text: text, position: position)
|
22
38
|
end
|
23
39
|
|
24
|
-
def morph(target, html = nil, **
|
25
|
-
|
40
|
+
def morph(target, html = nil, **attributes, &block)
|
41
|
+
custom_action_all :morph, targets: target, content: html, attributes: attributes, &block
|
26
42
|
end
|
27
43
|
|
28
44
|
def outer_html(target, html = nil, **attributes, &block)
|
29
|
-
|
45
|
+
custom_action_all :outer_html, targets: target, content: html, attributes: attributes, &block
|
30
46
|
end
|
31
47
|
|
32
48
|
def text_content(target, text, **attributes)
|
33
|
-
|
49
|
+
custom_action_all :text_content, targets: target, attributes: attributes.merge(text: text)
|
34
50
|
end
|
35
51
|
|
36
52
|
def set_meta(name, content, **attributes)
|
37
|
-
|
53
|
+
custom_action :set_meta, attributes: attributes.merge(name: name, content: content)
|
38
54
|
end
|
39
55
|
|
40
|
-
|
41
56
|
# Attribute Actions
|
42
57
|
|
43
58
|
def add_css_class(target, classes, **attributes)
|
44
|
-
|
59
|
+
custom_action_all :add_css_class, targets: target, attributes: attributes.merge(classes: classes)
|
45
60
|
end
|
46
61
|
|
47
62
|
def remove_attribute(target, attribute, **attributes)
|
48
|
-
|
63
|
+
custom_action_all :remove_attribute, targets: target, attributes: attributes.merge(attribute: attribute)
|
49
64
|
end
|
50
65
|
|
51
66
|
def remove_css_class(target, classes, **attributes)
|
52
|
-
|
67
|
+
custom_action_all :remove_css_class, targets: target, attributes: attributes.merge(classes: classes)
|
53
68
|
end
|
54
69
|
|
55
70
|
def set_attribute(target, attribute, value, **attributes)
|
56
|
-
|
71
|
+
custom_action_all :set_attribute, targets: target, attributes: attributes.merge(attribute: attribute, value: value)
|
57
72
|
end
|
58
73
|
|
59
74
|
def set_dataset_attribute(target, attribute, value, **attributes)
|
60
|
-
|
75
|
+
custom_action_all :set_dataset_attribute, targets: target, attributes: attributes.merge(attribute: attribute, value: value)
|
61
76
|
end
|
62
77
|
|
63
78
|
def set_property(target, property, value, **attributes)
|
64
|
-
|
79
|
+
custom_action_all :set_property, targets: target, attributes: attributes.merge(property: property, value: value)
|
65
80
|
end
|
66
81
|
|
67
82
|
def set_style(target, name, value, **attributes)
|
68
|
-
|
83
|
+
custom_action_all :set_style, targets: target, attributes: attributes.merge(name: name, value: value)
|
69
84
|
end
|
70
85
|
|
71
86
|
def set_styles(target, styles, **attributes)
|
72
|
-
|
87
|
+
custom_action_all :set_styles, targets: target, attributes: attributes.merge(styles: styles)
|
73
88
|
end
|
74
89
|
|
75
90
|
def set_value(target, value, **attributes)
|
76
|
-
|
91
|
+
custom_action_all :set_value, targets: target, attribtues: attributes.merge(value: value)
|
77
92
|
end
|
78
93
|
|
79
|
-
|
80
94
|
# Event Actions
|
81
95
|
|
82
96
|
def dispatch_event(target, name, detail: {}, **attributes)
|
83
|
-
|
97
|
+
custom_action_all :dispatch_event, targets: target, attributes: attributes.merge(name: name, detail: detail)
|
84
98
|
end
|
85
99
|
|
86
|
-
|
87
100
|
# Storage Actions
|
88
101
|
|
89
102
|
def clear_storage(type, **attributes)
|
90
|
-
|
103
|
+
custom_action :clear_storage, attributes: attributes.merge(type: type)
|
91
104
|
end
|
92
105
|
|
93
106
|
def clear_local_storage(**attributes)
|
@@ -99,7 +112,7 @@ module TurboPower
|
|
99
112
|
end
|
100
113
|
|
101
114
|
def remove_storage_item(key, type, **attributes)
|
102
|
-
|
115
|
+
custom_action :remove_storage_item, attributes: attributes.merge(key: key, type: type)
|
103
116
|
end
|
104
117
|
|
105
118
|
def remove_local_storage_item(key, **attributes)
|
@@ -110,9 +123,8 @@ module TurboPower
|
|
110
123
|
remove_storage_item(key, "session", **attributes)
|
111
124
|
end
|
112
125
|
|
113
|
-
|
114
126
|
def set_storage_item(key, value, type, **attributes)
|
115
|
-
|
127
|
+
custom_action :set_storage_item, attributes: attributes.merge(key: key, type: type, value: value)
|
116
128
|
end
|
117
129
|
|
118
130
|
def set_local_storage_item(key, value, **attributes)
|
@@ -123,66 +135,74 @@ module TurboPower
|
|
123
135
|
set_storage_item(key, value, "session", **attributes)
|
124
136
|
end
|
125
137
|
|
126
|
-
|
127
138
|
# Browser Actions
|
128
139
|
|
129
140
|
def redirect_to(url, action_name = nil, **attributes)
|
130
|
-
|
141
|
+
custom_action :redirect_to, attributes: attributes.merge(url: url, action: action_name)
|
131
142
|
end
|
132
143
|
|
133
144
|
def reload(**attributes)
|
134
|
-
|
145
|
+
custom_action :reload, attributes: attributes
|
135
146
|
end
|
136
147
|
|
137
148
|
def scroll_into_view(target, inline = "nearest", **attributes)
|
138
|
-
|
149
|
+
custom_action_all :scroll_into_view, targets: target, attributes: attributes.merge(inline: inline)
|
139
150
|
end
|
140
151
|
|
141
152
|
def set_cookie(cookie, **attributes)
|
142
|
-
|
153
|
+
custom_action :set_cookie, attributes: attributes.merge(cookie: cookie)
|
143
154
|
end
|
144
155
|
|
145
156
|
def set_cookie_item(key, value, **attributes)
|
146
|
-
|
157
|
+
custom_action :set_cookie_item, attributes: attributes.merge(key: key, value: value)
|
147
158
|
end
|
148
159
|
|
149
160
|
def set_focus(target, **attributes)
|
150
|
-
|
161
|
+
custom_action_all :set_focus, targets: target, attributes: attributes
|
151
162
|
end
|
152
163
|
|
164
|
+
def set_title(title, **attributes)
|
165
|
+
custom_action :set_title, attributes: attributes.merge(title: title)
|
166
|
+
end
|
153
167
|
|
154
168
|
# Browser History Actions
|
155
169
|
|
156
170
|
def history_go(delta, **attributes)
|
157
|
-
|
171
|
+
custom_action :history_go, attributes: attributes.merge(delta: delta)
|
158
172
|
end
|
159
173
|
|
160
174
|
def push_state(url, title = nil, state = nil, **attributes)
|
161
|
-
|
175
|
+
custom_action :push_state, attributes: attributes.merge(url: url, title: title, state: state)
|
162
176
|
end
|
163
177
|
|
164
178
|
def replace_state(url, title = nil, state = nil, **attributes)
|
165
|
-
|
179
|
+
custom_action :replace_state, attributes: attributes.merge(url: url, title: title, state: state)
|
166
180
|
end
|
167
181
|
|
168
|
-
|
169
182
|
# Debug Actions
|
170
183
|
|
171
184
|
def console_log(message, level = :log, **attributes)
|
172
|
-
|
185
|
+
custom_action :console_log, attributes: attributes.merge(message: message, level: level)
|
173
186
|
end
|
174
187
|
|
175
188
|
def console_table(data, columns, **attributes)
|
176
|
-
|
189
|
+
custom_action :console_table, attributes: attributes.merge(data: data, columns: columns)
|
177
190
|
end
|
178
191
|
|
179
192
|
# Notification Actions
|
180
193
|
|
181
194
|
def notification(title, options, **attributes)
|
182
|
-
|
195
|
+
custom_action :notification, attributes: attributes.merge(title: title, options: options)
|
183
196
|
end
|
184
197
|
|
198
|
+
# Turbo Frame Actions
|
199
|
+
|
200
|
+
def reload_turbo_frame(frame_id, **attributes)
|
201
|
+
custom_action :reload_turbo_frame, target: frame_id, attributes: attributes
|
202
|
+
end
|
203
|
+
|
204
|
+
def set_turbo_frame_src(frame_id, src, **attributes)
|
205
|
+
custom_action :reload_turbo_frame, target: frame_id, attributes: attributes.merge(src: src)
|
206
|
+
end
|
185
207
|
end
|
186
208
|
end
|
187
|
-
|
188
|
-
Turbo::Streams::TagBuilder.prepend(TurboPower::StreamHelper)
|
data/lib/turbo_power/version.rb
CHANGED
data/lib/turbo_power.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "turbo-rails"
|
3
4
|
require "turbo_ready"
|
5
|
+
|
4
6
|
require_relative "turbo_power/version"
|
7
|
+
require_relative "turbo_power/engine"
|
5
8
|
require_relative "turbo_power/stream_helper"
|
6
9
|
|
7
|
-
TurboReady.patch!
|
8
|
-
|
9
10
|
module TurboPower
|
10
11
|
end
|
data/test/test_helper.rb
CHANGED
File without changes
|
data/turbo_power.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Marco Roth"]
|
9
9
|
spec.email = ["marco.roth@hey.com"]
|
10
10
|
|
11
|
-
spec.summary = "
|
11
|
+
spec.summary = "Power-pack for Turbo Streams"
|
12
12
|
spec.description = spec.summary
|
13
13
|
spec.homepage = "https://github.com/marcoroth/turbo_power-rails"
|
14
14
|
spec.license = "MIT"
|
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.test_files = Dir["test/**/*.rb"]
|
30
30
|
|
31
|
-
spec.add_dependency "turbo-rails"
|
31
|
+
spec.add_dependency "turbo-rails", "~> 1.3.0"
|
32
32
|
spec.add_dependency "turbo_ready"
|
33
33
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo_power
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Roth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: turbo-rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.3.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: turbo_ready
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
41
|
+
description: Power-pack for Turbo Streams
|
42
42
|
email:
|
43
43
|
- marco.roth@hey.com
|
44
44
|
executables: []
|
@@ -52,7 +52,6 @@ files:
|
|
52
52
|
- LICENSE.txt
|
53
53
|
- README.md
|
54
54
|
- Rakefile
|
55
|
-
- app/helpers/turbo_power/streams/action_helper.rb
|
56
55
|
- bin/console
|
57
56
|
- bin/setup
|
58
57
|
- lib/turbo_power.rb
|
@@ -60,7 +59,8 @@ files:
|
|
60
59
|
- lib/turbo_power/stream_helper.rb
|
61
60
|
- lib/turbo_power/version.rb
|
62
61
|
- test/test_helper.rb
|
63
|
-
- test/
|
62
|
+
- test/turbo_power/stream_helper_test.rb
|
63
|
+
- test/turbo_power_test.rb
|
64
64
|
- turbo_power.gemspec
|
65
65
|
homepage: https://github.com/marcoroth/turbo_power-rails
|
66
66
|
licenses:
|
@@ -87,7 +87,8 @@ requirements: []
|
|
87
87
|
rubygems_version: 3.3.3
|
88
88
|
signing_key:
|
89
89
|
specification_version: 4
|
90
|
-
summary:
|
90
|
+
summary: Power-pack for Turbo Streams
|
91
91
|
test_files:
|
92
92
|
- test/test_helper.rb
|
93
|
-
- test/
|
93
|
+
- test/turbo_power/stream_helper_test.rb
|
94
|
+
- test/turbo_power_test.rb
|