render_turbo_stream 4.3.8 → 4.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95cbd0f9e34c5d905454c7107c682719e7f689e857ab48e94cd3a150ee475947
4
- data.tar.gz: 2dda5f5ddcdf497c8b1c937c7bada6fb0d93b24cc7b578e6c8c7e76dafebc106
3
+ metadata.gz: e7c77d7913ced14947092af6b05456c79581758a79ae83d9c4266cb6600a4922
4
+ data.tar.gz: 46b5b11f4f465b1956948996e3c9cfb47d79c8ea9becf03f76d32337320e4f1e
5
5
  SHA512:
6
- metadata.gz: 2c95e55aed3274b6f38f272262c2d35f23f50d660cb83cb7222fc75b046819b22c219d3022e64879c858bd7bb781fddb651c3d421827f806ae5931a394430754
7
- data.tar.gz: 23c2c473430f0c16506957f7abe7e03c119ac918b3895ed9dfa056141583831d1fa7f04523206b2cb47d44ce490c20ca974bf681cbb398511d0a91cbf31a0a28
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.
@@ -197,7 +197,7 @@ module RenderTurboStream
197
197
  end
198
198
 
199
199
  if save_action && if_success_redirect_to.present?
200
- response.status = 302
200
+ response.status = 303
201
201
  redirect_to if_success_redirect_to
202
202
  end
203
203
 
@@ -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 = 302
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
@@ -1,3 +1,3 @@
1
1
  module RenderTurboStream
2
- VERSION = "4.3.8"
2
+ VERSION = "4.3.10"
3
3
  end
@@ -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.8
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-26 00:00:00.000000000 Z
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