render_turbo_stream 4.2.0 → 4.3.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28e02fddd9493b46170e9e2767651c82748da1c0a0984940e57044489a24d472
|
4
|
+
data.tar.gz: a75224ab07323e2eef5d8f6905776c849a852068074d5e10a356303178b7d30a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45161e756cf12ebee2a2fd8941e93471ac001153bd39905597777f3fed48f5bb91e26fb254b41f0f30e340b4f47d1f743c2ec744a969e59e6b21baefdde40d5e
|
7
|
+
data.tar.gz: 8e610e79ae595f3af6290b450fb7b61a97c0166e883db6a5cae71bb095dac3481644d2964218478176376c1d0461144235cb6f2526d9af2dba97e21df999e57d
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
|
5
5
|
This gem has a second [README Turbo::StreamsChannel](https://gitlab.com/sedl/renderturbostream/-/blob/main/README-channels.md). Starting point is here. And I recommend that you download my [Quick-and-dirty test project](https://gitlab.com/sedl/renderturbostream_railsapp), set it up, see all the tests succeed, and then read through this README.
|
6
6
|
|
7
|
+
As of v4.3, locals inside partials should work as expected. If you are working with turbo but without this gem, please read [readme-locals](https://gitlab.com/sedl/renderturbostream/-/blob/main/readme-locals.md) to avoid tedious details.
|
8
|
+
|
7
9
|
Defining templates like `(create|update).turbo_stream.haml` is a heavy mix of logic and view. This gem separates logic and view so that `*.turbo_stream.*` templates are no longer necessary and the logic can stay on the ruby side.
|
8
10
|
|
9
11
|
For `:replace` actions, responses must be wrapped inside a `turbo_frame_tag` with a matching `target_id`. The gem will regex the content and wrap it by a `turbo_frame_tag` if necessary but not present. This way the matching `target_id` is only defined in one place. This check only happens on the first call after restarting the application in production and on every call if precompile assets is set to true in configs.
|
@@ -17,7 +19,7 @@ Has a testing strategy.
|
|
17
19
|
An overview of how we design a rails-7 application with turbo
|
18
20
|
is [published on dev.to](https://dev.to/chmich/rails-7-vite-wrapping-up-1pia).
|
19
21
|
|
20
|
-
|
22
|
+
Hope it helps :)
|
21
23
|
|
22
24
|
**Chris**
|
23
25
|
|
@@ -250,10 +252,19 @@ config.x.render_turbo_stream.first_argument_is_html_id = %[replace append prepen
|
|
250
252
|
|
251
253
|
This setting is relevant for testing helpers.
|
252
254
|
|
255
|
+
# Conclusion
|
256
|
+
|
257
|
+
The World Wide Web, founded around 1990 by [Tim Berners-Lee](https://en.wikipedia.org/wiki/Tim_Berners-Lee), was an html response from the server.
|
258
|
+
|
259
|
+
Frameworks like Angular, Ember, React, Vue brought a much better user experience, so called "single page applications". But they changed something: Now Javascript was the processor of HTML, which is far from the [Progressive Enhancement] (https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement)
|
260
|
+
|
261
|
+
The Rails core team has now achieved a milestone by turbo, for bringing a user experience like a single page app, but by reducing javascript. Somehow modern, back to the roots. Thank you.
|
262
|
+
|
263
|
+
This gem is an attempt to make this approach more convenient for developers.
|
253
264
|
|
254
265
|
# Contributing
|
255
266
|
|
256
|
-
|
267
|
+
Contributors welcome.
|
257
268
|
|
258
269
|
# License
|
259
270
|
|
@@ -15,8 +15,9 @@
|
|
15
15
|
<% ctl = { partial: args[:partial], target_id: args[:target_id], action: args[:action] } %>
|
16
16
|
|
17
17
|
|
18
|
-
|
19
|
-
<%
|
18
|
+
<% locals = args[:locals]&.symbolize_keys %>
|
19
|
+
<% partial = args[:partial] %>
|
20
|
+
<% rendered_html = render(partial: partial, locals: locals, formats: [:html]) %>
|
20
21
|
<% unless args[:target].present? %>
|
21
22
|
<% args[:target] = RenderTurboStream::Libs.fetch_arguments_from_rendered_string(rendered_html)[:target] %>
|
22
23
|
<% unless args[:target].present? %>
|
@@ -11,7 +11,9 @@
|
|
11
11
|
<% else %>
|
12
12
|
|
13
13
|
|
14
|
-
|
14
|
+
<% locals = s[:locals]&.symbolize_keys %>
|
15
|
+
<% partial = s[:partial] %>
|
16
|
+
<% html = (render partial: partial, locals: locals, formats: [:html]) %>
|
15
17
|
|
16
18
|
|
17
19
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: render_turbo_stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- christian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -86,5 +86,5 @@ requirements: []
|
|
86
86
|
rubygems_version: 3.4.12
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
|
-
summary:
|
89
|
+
summary: Make working with Turbo fun!
|
90
90
|
test_files: []
|