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: e0baf30f6152a1308687add8e14fda8ae815bfa43e54f9b4ffc6d859accc5e5b
4
- data.tar.gz: a61f84ab272df1447b3a4cd38ef5dcbf3702390e360cbb03d5f172f0056aa760
3
+ metadata.gz: 28e02fddd9493b46170e9e2767651c82748da1c0a0984940e57044489a24d472
4
+ data.tar.gz: a75224ab07323e2eef5d8f6905776c849a852068074d5e10a356303178b7d30a
5
5
  SHA512:
6
- metadata.gz: 5f6b26a244628091a4385883b04d588d682f1da0144dd56a827e74cceb5d61df5bdeeb8eb72e041c9203995b25f1b62605fde0d5d4eadc611b3ef7a02dd8df54
7
- data.tar.gz: bf8a7eaae4377b4a52f4200057f9dd4e8e8273fdee243f258cf1e65a63f935873d11a9686e73e1e353b54c5a05458781a6811c991f76650d1810da6dfa2b5e0a
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
- I am happy if it can help.
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
- Contribution welcome.
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
- <% rendered_html = render(partial: args[:partial], locals: args[:locals]&.symbolize_keys, formats: [:html]) %>
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
- <% html = (render s[:partial], locals: s[:locals]&.symbolize_keys, formats: [:html]) %>
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
 
@@ -1,3 +1,3 @@
1
1
  module RenderTurboStream
2
- VERSION = "4.2.0"
2
+ VERSION = "4.3.0"
3
3
  end
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.2.0
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-24 00:00:00.000000000 Z
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: Makes working with Turbo fun and ensures quality.
89
+ summary: Make working with Turbo fun!
90
90
  test_files: []