render_turbo_stream 3.0.2 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/lib/render_turbo_stream/controller_helpers.rb +1 -1
- data/lib/render_turbo_stream/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 536c9b9d2d37a6767f7134dea0a9a5d19e268dc2b15dd1fec52b6d29b9db99b1
|
4
|
+
data.tar.gz: 294c01ceb4e7370050350d49d85f68a9acc09ca435c70a945dcde9abf81108e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63e368ad4d85f001693395a66057e1229297e7332a5d2ac8bdf785fa1ec7042511a4d2ee491394dd11ebf6ac2dace4091f70a4b62945f43ec23d002ac9b6d4d6
|
7
|
+
data.tar.gz: 4c5c9758b9a063071219765a74d033f32d77fe4e3fd713ed95ec993334c71670d5694a36293a5acb8074a6e0ae6e8e677ca098cd1db78fb8fcc8e3c5eb52d014
|
data/README.md
CHANGED
@@ -2,13 +2,11 @@
|
|
2
2
|
|
3
3
|
DHH made a milestone in web development with [Rails 7, "Fulfilling a Vision"](https://rubyonrails.org/2021/12/15/Rails-7-fulfilling-a-vision). This gem is my contribution to that bold new step. The goal is to have a complete rails like workflow.
|
4
4
|
|
5
|
-
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.
|
5
|
+
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. And there are many ways and tedious details to handle redirects since Turbo! This can all be streamlined.
|
6
6
|
|
7
7
|
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`.
|
8
8
|
|
9
|
-
Logic to
|
10
|
-
|
11
|
-
This gem is in a early state.
|
9
|
+
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.
|
12
10
|
|
13
11
|
An overview of how we design a rails-7 application with turbo
|
14
12
|
is [published on dev.to](https://dev.to/chmich/rails-7-vite-wrapping-up-1pia).
|
@@ -248,8 +246,11 @@ assert_stream_response('form'){|e|e.css('.field_with_errors').inner_html.include
|
|
248
246
|
# make sure that there is one response to the target '#form' and it checks the rendered content
|
249
247
|
# if cero or more responses are expected, add a attribute like 'count: 0'
|
250
248
|
```
|
249
|
+
|
251
250
|
Possible matchers can be found at [Nokogiri](https://nokogiri.org/tutorials/searching_a_xml_html_document.html).
|
252
251
|
|
252
|
+
The `assert_stream_response`, like the other matchers, checks by default that the same target is not affected multiple times by the `:replace` action within the same response. This is defined in the underlying `RenderTurboStream::Test::Request::Libs.select_responses` method, which is also used for the `assert_channel_to_*` methods.
|
253
|
+
|
253
254
|
```ruby
|
254
255
|
# check actions from turbo_power gem
|
255
256
|
assert_stream_response('colored-element', action: 'remove_css_class') {|args| args.last == 'background-red' }
|
@@ -155,7 +155,7 @@ module RenderTurboStream
|
|
155
155
|
])
|
156
156
|
elsif save_action && redirect_on_success_to.present?
|
157
157
|
response.status = 302
|
158
|
-
if Rails.configuration.x.render_turbo_stream.use_channel_for_turbo_stream_save && helpers.
|
158
|
+
if (Rails.configuration.x.render_turbo_stream.use_channel_for_turbo_stream_save rescue false) && (helpers.current_user.id.present? rescue false)
|
159
159
|
streams.each do |s|
|
160
160
|
next unless s.is_a?(Hash)
|
161
161
|
Rails.logger.debug(" • Send by Cable => «#{s}»")
|
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: 3.0.
|
4
|
+
version: 3.0.4
|
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-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.0.
|
19
|
+
version: 7.0.3
|
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: 7.0.
|
26
|
+
version: 7.0.3
|
27
27
|
description: Handles translated flash messages, sets status and renders partials via
|
28
28
|
Turbo Stream or Turbo::StreamsChannel directly from the controller. No need to write
|
29
29
|
*.turbo_stream.* templates. Together with the turbo_power gem or custom turbo_stream
|