i18n_proofreading 0.10.4 → 0.10.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/app/controllers/i18n_proofreading/application_controller.rb +4 -0
- data/app/controllers/i18n_proofreading/suggestions_controller.rb +1 -1
- data/lib/generators/i18n_proofreading/install/templates/initializer.rb +5 -0
- data/lib/i18n_proofreading/configuration.rb +5 -0
- data/lib/i18n_proofreading/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: 92f93f3b80d87b86e0ec3b0ce33dc7c89cdd5ba9c2e7fc8b40bcb26b92a1a224
|
|
4
|
+
data.tar.gz: f994d6b60277c364a23eb299e344ab0af2f1fcdaa567966d07bd97352ac7f2fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d99a83e338ef612aa9a519eb115cb55f55a35978c514171070848e4dca9ea470dbb9055d29f04e5b950107611181a8719d8eff9d976272d7f4c67f8694186ff3
|
|
7
|
+
data.tar.gz: 3a296e3305dcce5f55b22d01843f5a885a34d805f30f4dcfa794a08138948f06125a438d550c03e142409d1a3e60e6ebf32259dd470f930b42c945b0e892340b
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.10.5]
|
|
6
|
+
|
|
7
|
+
- Added `config.admin_layout`, letting host apps render the proofreading
|
|
8
|
+
dashboard inside their own admin layout while keeping the standalone gem
|
|
9
|
+
layout as the default.
|
|
10
|
+
|
|
5
11
|
## [0.10.4]
|
|
6
12
|
|
|
7
13
|
- Redesigned the proofreading admin dashboard into a two-column review layout
|
|
@@ -6,6 +6,10 @@ module I18nProofreading
|
|
|
6
6
|
|
|
7
7
|
private
|
|
8
8
|
|
|
9
|
+
def i18n_proofreading_admin_layout
|
|
10
|
+
I18nProofreading.config.admin_layout
|
|
11
|
+
end
|
|
12
|
+
|
|
9
13
|
# Gate for the widget's public API (submit a suggestion, read prior context).
|
|
10
14
|
# The client can set the cookie, but it can never reach the endpoints unless
|
|
11
15
|
# the app itself says the tool is available for this request.
|
|
@@ -9,7 +9,7 @@ module I18nProofreading
|
|
|
9
9
|
before_action :require_admin, only: %i[index show]
|
|
10
10
|
before_action :set_suggestion, only: :show
|
|
11
11
|
|
|
12
|
-
layout
|
|
12
|
+
layout :i18n_proofreading_admin_layout, only: %i[index show]
|
|
13
13
|
|
|
14
14
|
# Throttle the public submission endpoint per IP so one user or bot can't
|
|
15
15
|
# flood the table. Uses the rate limiter built into Rails 7.2+ (backed by
|
|
@@ -16,6 +16,11 @@ I18nProofreading.configure do |config|
|
|
|
16
16
|
# development only; wire it to your own admin check to open it elsewhere.
|
|
17
17
|
#
|
|
18
18
|
# config.authorize_admin = ->(request) { request.env["warden"]&.user&.admin? }
|
|
19
|
+
#
|
|
20
|
+
# Render the dashboard inside your app's admin layout. Default: the gem's
|
|
21
|
+
# standalone dashboard layout.
|
|
22
|
+
#
|
|
23
|
+
# config.admin_layout = "admin/application"
|
|
19
24
|
|
|
20
25
|
# Attribute a suggestion to a user (optional). Return an object responding to
|
|
21
26
|
# #id (ideally #email too), or nil. Receives the Rack::Request. You resolve the
|
|
@@ -21,6 +21,10 @@ module I18nProofreading
|
|
|
21
21
|
# the dashboard until you wire it to your own admin check.
|
|
22
22
|
attr_accessor :authorize_admin
|
|
23
23
|
|
|
24
|
+
# Layout used by the triage dashboard. Override this to render it inside
|
|
25
|
+
# your app's admin shell, e.g. "admin/application".
|
|
26
|
+
attr_accessor :admin_layout
|
|
27
|
+
|
|
24
28
|
# Resolve the current user for attribution (optional). Return an object
|
|
25
29
|
# responding to #id, or nil. Receives the Rack::Request.
|
|
26
30
|
attr_accessor :current_user
|
|
@@ -68,6 +72,7 @@ module I18nProofreading
|
|
|
68
72
|
@enabled_environments = %w[development staging]
|
|
69
73
|
@enabled = ->(_request) { true }
|
|
70
74
|
@authorize_admin = ->(_request) { Rails.env.development? }
|
|
75
|
+
@admin_layout = 'i18n_proofreading/application'
|
|
71
76
|
@current_user = ->(_request) {}
|
|
72
77
|
@author_label = ->(user) { user.respond_to?(:email) ? user.email : user&.to_s }
|
|
73
78
|
@available_locales = -> { I18n.available_locales.map(&:to_s) }
|