render_turbo_stream 4.3.8 → 4.3.10
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 -2
- data/lib/render_turbo_stream/controller_channel_helpers.rb +1 -1
- data/lib/render_turbo_stream/controller_helpers.rb +1 -1
- data/lib/render_turbo_stream/test/system/helpers.rb +18 -0
- data/lib/render_turbo_stream/version.rb +1 -1
- data/lib/render_turbo_stream.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7c77d7913ced14947092af6b05456c79581758a79ae83d9c4266cb6600a4922
|
4
|
+
data.tar.gz: 46b5b11f4f465b1956948996e3c9cfb47d79c8ea9becf03f76d32337320e4f1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ece99c25ab9f6dc65d72c8d16993c81d1c6f4f0681414e14d6bff78c49e37494d3e3ddcd567b1acc10b0b642b22bbb458800167dd0e327dcabce679a712fa2f
|
7
|
+
data.tar.gz: e71788a07ca646d45ae6efe9fcbe536a52adb74c0c57435757949b9acbcd1f8f2f8468382f2449c2b8fa10c2efd75706efca88d4a8ea29aab732b4e1bc30d972
|
data/README.md
CHANGED
@@ -49,9 +49,10 @@ spec/rails_helper.rb (We are using rspec instead of minitest)
|
|
49
49
|
|
50
50
|
```ruby
|
51
51
|
RSpec.configure do |config|
|
52
|
-
|
52
|
+
#...
|
53
53
|
config.include RenderTurboStream::Test::Request::Helpers, type: :request
|
54
54
|
config.include RenderTurboStream::Test::Request::ChannelHelpers, type: :request
|
55
|
+
config.include RenderTurboStream::Test::System::Helpers, type: :system
|
55
56
|
end
|
56
57
|
```
|
57
58
|
|
@@ -192,6 +193,7 @@ The target ID for turbo has to be unique for sure, and it has to be nice, becaus
|
|
192
193
|
```ruby
|
193
194
|
# target_id(virtual_view_path, object)
|
194
195
|
target_id('customers/_form', Customer.new) #=> 'new-customer-form'
|
196
|
+
target_id('form', Customer.new) #=> 'new-customer-form'
|
195
197
|
```
|
196
198
|
|
197
199
|
View-helper: Assuming we are inside `customers/_my_form`:
|
@@ -205,7 +207,8 @@ target_id(Customer.first) #=> 'customer-1-my-form'
|
|
205
207
|
target_id( [Customer.first, Article.last, 'hello'] ) #=> 'customer-1-article-7-hello-my-form'
|
206
208
|
target_id('hi-joe') #=> 'hi-joe'
|
207
209
|
|
208
|
-
target_id_css('hi-joe') #=> '#hi-joe'
|
210
|
+
target_id_css('hi-joe') #=> '#hi-joe'
|
211
|
+
#=> is available for system tests, example for capybara: «within target_id_css('articles/_form', @article) do ..
|
209
212
|
```
|
210
213
|
|
211
214
|
Why include the filename in a html-id? Because for turbo its likely to have multiple cases for the same object on the same page, for example: _form, _show, _password. These can all be the same customer.
|
@@ -76,7 +76,7 @@ module RenderTurboStream
|
|
76
76
|
allow_channel = (Rails.configuration.x.render_turbo_stream.allow_channel_to_me_for_turbo_stream_save rescue false) && (helpers.current_user.id.present? rescue false)
|
77
77
|
|
78
78
|
if save_action && if_success_turbo_redirect_to.present?
|
79
|
-
response.status =
|
79
|
+
response.status = 303
|
80
80
|
flash[:alert] = flashes[:alerts]
|
81
81
|
flash[:notice] = flashes[:notices]
|
82
82
|
Rails.logger.debug(" • Successful saved && Redirect by «turbo_redirect_to»")
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RenderTurboStream
|
2
|
+
module Test
|
3
|
+
module System
|
4
|
+
module Helpers
|
5
|
+
|
6
|
+
def target_id(relative_view_path, object)
|
7
|
+
libs = RenderTurboStream::Libs
|
8
|
+
libs.target_id(relative_view_path, object)
|
9
|
+
end
|
10
|
+
|
11
|
+
def target_id_css(relative_view_path, object)
|
12
|
+
"##{target_id(relative_view_path, object)}"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/render_turbo_stream.rb
CHANGED
@@ -4,6 +4,7 @@ require 'render_turbo_stream/engine'
|
|
4
4
|
|
5
5
|
require 'render_turbo_stream/test/request/channel_helpers'
|
6
6
|
require 'render_turbo_stream/test/request/helpers'
|
7
|
+
require 'render_turbo_stream/test/system/helpers'
|
7
8
|
require 'render_turbo_stream/test/request/libs'
|
8
9
|
|
9
10
|
require 'render_turbo_stream/controller_helpers'
|
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.3.
|
4
|
+
version: 4.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- christian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06
|
11
|
+
date: 2023-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- lib/render_turbo_stream/test/request/channel_helpers.rb
|
62
62
|
- lib/render_turbo_stream/test/request/helpers.rb
|
63
63
|
- lib/render_turbo_stream/test/request/libs.rb
|
64
|
+
- lib/render_turbo_stream/test/system/helpers.rb
|
64
65
|
- lib/render_turbo_stream/version.rb
|
65
66
|
- lib/render_turbo_stream/view_helpers.rb
|
66
67
|
- lib/tasks/render_turbo_stream_tasks.rake
|