testimonials 0.1.4 → 0.1.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +14 -0
- data/lib/generators/testimonials/install/templates/initializer.rb +7 -0
- data/lib/testimonials/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f22788e95288902bcd21a32e81a39841fcc71fb844b10c96ae768726e51026a1
|
|
4
|
+
data.tar.gz: 3cd300be21ce03785c3f10ac081299278ceeb434bdcd250496a80a67115f2e63
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1fc585035952eedaac590b367271939f8c825ba44a8bc010f6e45223372c68aaab3ea773dc0f320420fc8b0cda3ccfa26ba7fc70a8800a6a03567eb77e9b8acd
|
|
7
|
+
data.tar.gz: 650ea64d54721adbe117e821e1f1873fbc84bc5d2320c1486c4cce866a788c12d05c19509d72c6bb390ea9bf5bff944a7f0b9354681d26e3914c295eef5f2653
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.5
|
|
4
|
+
|
|
5
|
+
- Docs: show how to wire `current_user` with Rails 8's built-in authentication
|
|
6
|
+
(`bin/rails generate authentication`), alongside the existing Devise/Warden
|
|
7
|
+
example — in the README and the generated initializer.
|
|
8
|
+
|
|
3
9
|
## 0.1.4
|
|
4
10
|
|
|
5
11
|
- Validation and submit errors are announced to screen readers: every
|
data/README.md
CHANGED
|
@@ -115,6 +115,20 @@ Testimonials.configure do |config|
|
|
|
115
115
|
end
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
+
`current_user` (and any admin gate) receives the raw request, so it works
|
|
119
|
+
with whatever auth you have:
|
|
120
|
+
|
|
121
|
+
```ruby
|
|
122
|
+
# Devise / Warden:
|
|
123
|
+
config.current_user = ->(request) { request.env["warden"]&.user }
|
|
124
|
+
|
|
125
|
+
# Rails 8 built-in auth (bin/rails generate authentication):
|
|
126
|
+
config.current_user = lambda do |request|
|
|
127
|
+
token = request.cookies["session_token"]
|
|
128
|
+
Session.find_signed(token)&.user if token
|
|
129
|
+
end
|
|
130
|
+
```
|
|
131
|
+
|
|
118
132
|
### Guiding questions, localized
|
|
119
133
|
|
|
120
134
|
The questions shown above the form ("How has %{app} helped you?") fight
|
|
@@ -15,7 +15,14 @@ Testimonials.configure do |config|
|
|
|
15
15
|
|
|
16
16
|
# Attribute submissions to a user (optional). Return an object responding
|
|
17
17
|
# to #id, or nil. Receives the request.
|
|
18
|
+
# Devise / Warden:
|
|
18
19
|
# config.current_user = ->(request) { request.env["warden"]&.user }
|
|
20
|
+
#
|
|
21
|
+
# Rails 8 built-in auth (bin/rails generate authentication):
|
|
22
|
+
# config.current_user = lambda do |request|
|
|
23
|
+
# token = request.cookies["session_token"]
|
|
24
|
+
# Session.find_signed(token)&.user if token
|
|
25
|
+
# end
|
|
19
26
|
|
|
20
27
|
# Attribution stored with a signed-in user's submission.
|
|
21
28
|
# config.user_display = ->(user) { { name: user.name, email: user.email } }
|
data/lib/testimonials/version.rb
CHANGED