render_turbo_stream 1.4.8 → 1.4.9
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9b6a483735fb6cb6abf28e28da8a18993727faaa76f22c77a52e99b5df3f738
|
4
|
+
data.tar.gz: 0773d821f8a94b1094cdd99054365ad2792b006be27fc93445e379e8d8bb46a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96637194a72cfc53cc649056021967e107a150bfb702b7ad951c611c23fab424c72554c9b1aea6d82606546a4342259c797a38c4a08405ceed568869e62acba0
|
7
|
+
data.tar.gz: 4008a55b80afe4b2493d3fa980213554f501c39bdda1aa1cd15a6522876198f987aff0a65e83f1e0ea754f13be31938f17bbcbadc06efe570b7a25f59e0b95c2
|
data/README.md
CHANGED
@@ -276,10 +276,10 @@ includes the plugin and has tests done by rspec/request and capybara.
|
|
276
276
|
|
277
277
|
## More Configs
|
278
278
|
|
279
|
-
On test helpers, the marker for a turbo-stream target is in most cases the id of the target element. This is true for the standard turbo-stream functions. On `turbo_power` it is the same in most cases. `RenderTurboStream::Libs.
|
279
|
+
On test helpers, the marker for a turbo-stream target is in most cases the id of the target element. This is true for the standard turbo-stream functions. On `turbo_power` it is the same in most cases. `RenderTurboStream::Libs.first_arg_is_html_id()` checks for which methods this is true. You can override this:
|
280
280
|
|
281
281
|
```ruby
|
282
|
-
config.x.render_turbo_stream.
|
282
|
+
config.x.render_turbo_stream.first_argument_is_html_id = %[replace append prepend turbo_frame_set_src]
|
283
283
|
```
|
284
284
|
|
285
285
|
This setting is relevant for testing helpers.
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<% streams.each do |s| %>
|
5
5
|
|
6
6
|
<% if s.is_a?(Array) %>
|
7
|
-
<% attr_id = RenderTurboStream::Libs.
|
7
|
+
<% attr_id = RenderTurboStream::Libs.first_arg_is_html_id(s.first) %>
|
8
8
|
<% h = { attributes: s, type: 'command' } %>
|
9
9
|
<% h[:target] = "##{s.second}" if attr_id %>
|
10
10
|
<% rendered_partials.push(h) %>
|
@@ -62,7 +62,7 @@ module RenderTurboStream
|
|
62
62
|
|
63
63
|
if r['type'] == 'command'
|
64
64
|
act = r['attributes'].first
|
65
|
-
is_id = RenderTurboStream::Libs.
|
65
|
+
is_id = RenderTurboStream::Libs.first_arg_is_html_id(act)
|
66
66
|
if action.to_s == act && is_id && r['attributes'].second == id.to_s
|
67
67
|
k = [act, r['attributes'].second].join('-')
|
68
68
|
counts[k] ||= 0
|
data/lib/render_turbo_stream.rb
CHANGED
@@ -260,8 +260,8 @@ module RenderTurboStream
|
|
260
260
|
# This method checks for that
|
261
261
|
# it includes the methods from turbo-power
|
262
262
|
# used for test helpers
|
263
|
-
def self.
|
264
|
-
config = Rails.configuration.x.render_turbo_stream.
|
263
|
+
def self.first_arg_is_html_id(method)
|
264
|
+
config = Rails.configuration.x.render_turbo_stream.first_argument_is_html_id
|
265
265
|
default = [
|
266
266
|
:graft,
|
267
267
|
:morph,
|