render_turbo_stream 3.0.4 → 3.0.5

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: 536c9b9d2d37a6767f7134dea0a9a5d19e268dc2b15dd1fec52b6d29b9db99b1
4
- data.tar.gz: 294c01ceb4e7370050350d49d85f68a9acc09ca435c70a945dcde9abf81108e0
3
+ metadata.gz: c984de11f7923f03531f0b53b0a4224bd3c56520f75bc4e92e16292c9e2a9e86
4
+ data.tar.gz: 184129722f704f61599a022f3ef6bb7306c3b7d1f74a5770a666cac9835e5839
5
5
  SHA512:
6
- metadata.gz: 63e368ad4d85f001693395a66057e1229297e7332a5d2ac8bdf785fa1ec7042511a4d2ee491394dd11ebf6ac2dace4091f70a4b62945f43ec23d002ac9b6d4d6
7
- data.tar.gz: 4c5c9758b9a063071219765a74d033f32d77fe4e3fd713ed95ec993334c71670d5694a36293a5acb8074a6e0ae6e8e677ca098cd1db78fb8fcc8e3c5eb52d014
6
+ metadata.gz: 5983031570c67f03c85ae84341d51bfd6cbb76f2f1e5b1543f2434cc6d133edbcdbd25205c6162b55bdacaa7531c79a411f397c65695598b76096e1395c54182
7
+ data.tar.gz: e672f2427971215dada8b1b3b6047a6331e0c0e39f7c1b5166f2fe2992e35cbc03dc94fb7d39abcc2f1091d20f650d3b0ad6b2720fa4f66b4476810b2865785f
data/README.md CHANGED
@@ -51,22 +51,27 @@ Required Configurations for Flash Partial
51
51
  config.x.render_turbo_stream.flash_partial = 'layouts/flash'
52
52
  config.x.render_turbo_stream.flash_id = 'flash-box'
53
53
  config.x.render_turbo_stream.flash_action = 'prepend'
54
- config.x.render_turbo_stream.use_channel_for_turbo_stream_save = true
54
+ config.x.render_turbo_stream.allow_channel_for_turbo_stream_save = true
55
55
  ```
56
56
 
57
+ For the latter you have to setup channels, see below.
58
+
57
59
  The corresponding partials for flashes could look [like this](https://gitlab.com/sedl/renderturbostream/-/wikis/Flashes-example)
58
60
 
59
61
  **Translations**
60
62
 
61
63
  ```
62
- activerecord.success.successfully_created
63
- activerecord.success.successfully_updated
64
- activerecord.errors.messages.could_not_create
65
- activerecord.errors.messages.could_not_update
64
+ en:
65
+ activerecord:
66
+ success:
67
+ successfully_created: '%<model_name>s successfully created'
68
+ successfully_updated: '%<model_name>s successfully updated'
69
+ errors:
70
+ messages:
71
+ could_not_create: '%<model_name>s could not be created'
72
+ could_not_update: '%<model_name>s could not be updated'
66
73
  ```
67
74
 
68
- example value: `"%<model_name>s successfully created"`
69
-
70
75
  Model name translations, see: Rails Docs.
71
76
 
72
77
  **Turbo power**
@@ -156,7 +161,7 @@ Suppose you have a CRUD controller that should do all its actions inside a turbo
156
161
  There are two workarounds:
157
162
 
158
163
  ```ruby
159
- config.x.render_turbo_stream.use_channel_for_turbo_stream_save = true
164
+ config.x.render_turbo_stream.allow_channel_for_turbo_stream_save = true
160
165
  ```
161
166
 
162
167
  With this config, the `turbo_stream_save` method will send flash messages through `Turbo::StreamsChannel` (if installed as described above) to a channel to the currently logged in user in parallel with the redirect.
@@ -2,7 +2,7 @@ module RenderTurboStream
2
2
  module ControllerHelpers
3
3
 
4
4
  # Handles translated flash messages as defined in translations and configs.
5
- # If :redirect_on_success_to and channel set up and use_channel_for_turbo_stream_save are configured, sends flash message by channel_to_me.
5
+ # If :redirect_on_success_to and channel set up and allow_channel_for_turbo_stream_save are configured, sends flash message by channel_to_me.
6
6
  # you can add more stream actions to the same response
7
7
 
8
8
  def turbo_stream_save(
@@ -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 rescue false) && (helpers.current_user.id.present? rescue false)
158
+ if (Rails.configuration.x.render_turbo_stream.allow_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}»")
@@ -1,3 +1,3 @@
1
1
  module RenderTurboStream
2
- VERSION = "3.0.4"
2
+ VERSION = "3.0.5"
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: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian