render_turbo_stream 4.0.0 → 4.0.2

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: 525e9a802269d71e60be6cbc44fe62ebbe677a89fd49e048b1dbc11c6ae4d2b0
4
- data.tar.gz: 5b47c7b9a7dcc49491e4ab20eb2637654b62e971afe0abdf481ec9210e97f145
3
+ metadata.gz: 35750e37d2f65c71588b62ebcd0b7986d0e0012bd8674808dd0149f81b5ee967
4
+ data.tar.gz: 3937766529f3c5418b29895196c5a8acbb1bfeecf0e6464faf7c310d1a5ac097
5
5
  SHA512:
6
- metadata.gz: c532c3c9a5307547f260ff1feefea8e43b3cb09e42c43eacad1771c8a72b16a9843703024e1a58891a0498592c53dd296f2a6d7ef0dac72554c838c7c42d3915
7
- data.tar.gz: f1c5cf8193d9c3214d60c492d73e7ebaf844b848dfa88a602ee235af9c0fbe90d757584938cf3b58d661d507b119791d4fe544968580654406c63abdfe4c1864
6
+ metadata.gz: c0cd96285c1d01d203b5afd33094f4be26606c40e70bab2161a36202219f713f273ae97534dc35bf722b5fe7091e034b68028c0f2f9513e20b3346d45c3f1b67
7
+ data.tar.gz: ebdbca94432c7e14d01e93729e8d9361d5ffacba0ea90b20148d22882e2e7bd248dda610d8a840db6cfecdddffbe94eaa139f7527e432079fc8231525a709541
data/README.md CHANGED
@@ -2,24 +2,24 @@
2
2
 
3
3
  2021 DHH annouced a great milestone in web development with [Rails 7, "Fulfilling a Vision"](https://rubyonrails.org/2021/12/15/Rails-7-fulfilling-a-vision).
4
4
 
5
- TTo say it up front: If you want to have all the benefits of Turbo without disturbing the handy default Rails workflow, you have to use WebSockets, which are well integrated in Turbo, see [README Turbo::StreamsChannel](https://gitlab.com/sedl/renderturbostream/-/blob/main/README-channels.md). But the 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.
5
+ To say it up front: If you want to have all the benefits of Turbo without disturbing the handy default Rails workflow, you must use WebSockets sometimes, which are well integrated in Turbo, see [README Turbo::StreamsChannel](https://gitlab.com/sedl/renderturbostream/-/blob/main/README-channels.md). But the 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
- Defining templates like `(create|update).turbo_stream.haml` annoyed me. Because it is a heavy mix of logic and view. Working consistently with turbo_stream or Turbo Streams Channel means shooting a lot of partials from the backend to the frontend. This gem checks if a partial has the necessary frames, wraps it, and includes a helper to make instance variables work for Turbo Streams as well. This way, a simple as-usual partial is compatible for withh and without turbo, and can be sent in any way.
7
+ 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
8
 
9
- It has a testing strategy!
9
+ 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.
10
10
 
11
- A lot of details for handling many different ways of redirect, that are possible and necessary since Turbo, are handled.
11
+ If the turbo stream action is `:replace' and the content is not wrapped by `turbo_frame_tag', the gem will wrap it. So the partial content is checked by regex. 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.
12
12
 
13
- Execute [turbo_power](https://github.com/marcoroth/turbo_power) commands such as adding a css class to an html element, pushing a state to the browser history, or running custom javascript actions through Turbo Stream can be written in pure ruby code. No need for embeds like `.html.erb`.
13
+ There are many different ways to handle **redirects** since turbo. Some details are handled here.
14
14
 
15
- Logic to Ruby, views to views, and the space in between for the gem! And all this together with a testing strategy for the Ruby side.
15
+ Execute [turbo_power](https://github.com/marcoroth/turbo_power) commands such as adding a css class to an html element, can be sent directly from the controller.
16
+
17
+ Has a testing strategy.
16
18
 
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
- Hope it can help you.
21
-
22
- April 2023 first released this gem is in a very early state. I am happy if others contribute for increase the quality of this new kind of working with rails 7.
22
+ I am happy if it can help.
23
23
 
24
24
  **Chris**
25
25
 
@@ -13,7 +13,7 @@ module RenderTurboStream
13
13
  @action = action
14
14
  @partial_path = partial
15
15
  @template_path = template
16
- @available_instance_variables = available_instance_variables
16
+ @available_instance_variables = nil #available_instance_variables #=> because if an instance variable was not set on production and the first call, and it was set on a later call, the gem would not know that and not set it.
17
17
  prt = (partial ? partial : template).split('/')
18
18
  if prt.length < 2
19
19
  raise 'Partial or template path must always be specified with the controller path, for example «articles/partial_name».'
@@ -1,3 +1,3 @@
1
1
  module RenderTurboStream
2
- VERSION = "4.0.0"
2
+ VERSION = "4.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render_turbo_stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian
@@ -24,12 +24,12 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 7.0.3
27
- description: Handles translated flash messages, sets status, wrapps partials in the
28
- necessary frames and renders via Turbo Stream or Turbo::StreamsChannel directly
29
- from the controller. No need to write *.turbo_stream.* templates. Together with
30
- the turbo_power gem or custom turbo_stream actions, it can run javascript. Redirects
31
- can be handled easily and in multiple ways. Through request testing helpers, this
32
- allows for consistent testing strategy.
27
+ description: 'It brings TurboStreams and TurboStreams::Channel together in a unified
28
+ workflow with one testing strategy. It separates logic and views: All partial handling
29
+ can be controlled directly from the controller. No need to write *.turbo_stream.*
30
+ templates. A normal partial can be sent in any way. Execution of javascript actions
31
+ can be done directly from the controller. Demo project with all this built in along
32
+ with system and request tests is available.'
33
33
  email:
34
34
  - christian@sedlmair.ch
35
35
  executables: []
@@ -85,5 +85,5 @@ requirements: []
85
85
  rubygems_version: 3.4.12
86
86
  signing_key:
87
87
  specification_version: 4
88
- summary: Complete workflow for turbo that just works and has a testing strategy.
88
+ summary: Complete workflow for turbo with a testing strategy.
89
89
  test_files: []