render_turbo_stream 1.3.1 → 1.3.2

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: 6e7cebbb4a51d0abb9d5f658b860c08c700ecea7faa041c7615adb867aa48983
4
- data.tar.gz: 25dcad69063801eed435438e5e93c6d7ffec9436da21345326a15b8822b03706
3
+ metadata.gz: 9eb2626dccbe4886e8e1aa497563e1e6e1cf32b2edb392579bd136fe8ef99934
4
+ data.tar.gz: d49b68d7b6dc3d320b90d6f1618ba4d502020933cc3fb0074f072994d6c9b789
5
5
  SHA512:
6
- metadata.gz: 1bb0a1a79bf629a021f446c9960e84292d195ac2ad28990e0b585d90e4e4e5098b0ecd06f852e6ce6f3fbdcaef95455f3e4e7049e3addb5607e6f5296a2ad287
7
- data.tar.gz: a523ef0d125b9af140d71cf66cfa45c05082bb58cc0ba30038b11d3bd33db4dd549203e700c8bdba1c8c1ecdc282fb98144d068a98901578530b09cfd0b366bf
6
+ metadata.gz: 68ad22ed499b2eddb73d36db65f15e1e23f7c8e71863abdfccd2292ecb4d3ffc976eb66e47a9197073fbbd891d55af2a3aaaa812767dd6d4dff518f0bcc32c19
7
+ data.tar.gz: 1ecfd07c4da4e35b270c223553c8dd85448e6c725d5a310def53669276617af8a932ce0439079f0f0f91210801b88ebc6bb5057aade21578889e37d475ec2391
data/README.md CHANGED
@@ -34,11 +34,13 @@ RSpec.configure do |config|
34
34
  end
35
35
  ```
36
36
 
37
- **Redirection**
37
+ **Redirection and more**
38
38
 
39
39
  For redirection to work, you must follow the installation steps
40
40
  from [turbo_power](https://github.com/marcoroth/turbo_power).
41
41
 
42
+ **Flash**
43
+
42
44
  Required Configurations for Flash Partial
43
45
 
44
46
  ```ruby
@@ -51,8 +53,7 @@ The corresponding partials for flashes could look [like this](https://gitlab.com
51
53
 
52
54
  ## Usage
53
55
 
54
- `turbo_stream_save` is a special method for streamlining `update` or `create` functions for `turbo_stream`, which might
55
- look like this:
56
+ `turbo_stream_save` is a special method for streamlining `update' or `create' functions with `turbo_stream'. A controller action for update might look like this:
56
57
 
57
58
  ```ruby
58
59
 
@@ -64,7 +65,7 @@ def update
64
65
  end
65
66
  ```
66
67
 
67
- This will set a status, generate a flash message and perform `render_turbo_stream`, which could result in something like this:
68
+ This will set a status, generate a flash message and perform `render_turbo_stream`, which would, if update succeeded result in something like this:
68
69
 
69
70
  ```ruby
70
71
  render_turbo_stream(
@@ -84,8 +85,6 @@ render_turbo_stream(
84
85
 
85
86
  The `stream_partial` method is nothing else than a singular of `render_turbo_stream`.
86
87
 
87
- **locals**: The hash for locals goes through a `symbolize_keys`, so you need to use locals in used partials like this: `locals[:message]`.
88
-
89
88
  ```ruby
90
89
  stream_partial(
91
90
  id,
@@ -95,17 +94,19 @@ stream_partial(
95
94
  )
96
95
  ```
97
96
 
97
+ **locals**: The hash for locals goes through a `symbolize_keys`, so you need to use locals in used partials like this: `locals[:message]`.
98
+
98
99
  ## More options
99
100
 
100
- `render_turbo_stream` interprets a hash as a partial to be sent by `turbo_stream` and an array as a command to be sent. This should allow you to perform most actions from, for example, [turbo_power](https://github.com/marcoroth/turbo_power). An example of rendering a partial and adding a css class to an html element would look like this:
101
+ `render_turbo_stream` interprets a hash as a partial to be sent by `turbo_stream` and an array as a command to be sent. This allows you to perform most actions from e.g. [turbo_power](https://github.com/marcoroth/turbo_power). An example of adding a css class to an html element and updating the browser history would look like this:
101
102
 
102
103
  ```ruby
103
104
  render_turbo_stream(
104
105
  [
105
- {
106
- id: 'form',
107
- partial: 'form'
108
- },
106
+ [
107
+ :push_state,
108
+ '/articles/my-special-path'
109
+ ],
109
110
  [
110
111
  :add_css_class,
111
112
  '#colored-element',
@@ -1,3 +1,3 @@
1
1
  module RenderTurboStream
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
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: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-22 00:00:00.000000000 Z
11
+ date: 2023-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,11 +24,11 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 7.0.4.3
27
- description: Writing views like (create|update).turbo_stream.haml annoyed me. This
28
- gem handles translated flash messages, sets status, and renders partials through
29
- turbo-stream. You can control it directly from the controller. With the turbo_power
30
- gem you can also handle predefined actions like redirects and much more. Includes
31
- helpers for enabling request testing.
27
+ description: Writing templates like (create|update).turbo_stream.haml annoyed me.
28
+ This gem handles translated flash messages, sets status, and renders partials through
29
+ turbo-stream directly from the controller. Together with the turbo_power gem or
30
+ custom turbo-stream actions, you can also handle predefined javascript actions like
31
+ redirects. Includes helpers for enabling request testing.
32
32
  email:
33
33
  - christian@sedlmair.ch
34
34
  executables: []
@@ -72,6 +72,5 @@ requirements: []
72
72
  rubygems_version: 3.4.12
73
73
  signing_key:
74
74
  specification_version: 4
75
- summary: Render partials by turbo-stream directly from the controller. Test helpers
76
- included.
75
+ summary: Render partials or redirects directly from the controller. Test helpers included.
77
76
  test_files: []