render_turbo_stream 1.3.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -11
- data/lib/render_turbo_stream/version.rb +1 -1
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9eb2626dccbe4886e8e1aa497563e1e6e1cf32b2edb392579bd136fe8ef99934
|
4
|
+
data.tar.gz: d49b68d7b6dc3d320b90d6f1618ba4d502020933cc3fb0074f072994d6c9b789
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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
|
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
|
-
|
107
|
-
|
108
|
-
|
106
|
+
[
|
107
|
+
:push_state,
|
108
|
+
'/articles/my-special-path'
|
109
|
+
],
|
109
110
|
[
|
110
111
|
:add_css_class,
|
111
112
|
'#colored-element',
|
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.
|
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-
|
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
|
28
|
-
gem handles translated flash messages, sets status, and renders partials through
|
29
|
-
turbo-stream
|
30
|
-
|
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 or
|
76
|
-
from the controller. Test helpers included.
|
75
|
+
summary: Render partials or redirects directly from the controller. Test helpers included.
|
77
76
|
test_files: []
|