page_meta 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/page_meta/base.rb +2 -2
- data/lib/page_meta/translator.rb +18 -15
- data/lib/page_meta/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: f948175f35af9b5f92902225e895d0e7c7fe664afd54f3ca8d6d82fc77c9b2c5
|
4
|
+
data.tar.gz: 6034bbcff7b2079c8f234e447ffc8804bfda09989874a66952bc467765cc7b1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '06529e97cbaf313bd71be194e578cc8ce3f3c1f8d3b646fa1b71adf10bb81f7c3f31584683f29c64f158dd7ee6e4e196ac5a5e6cb548372911cc278e8a9d1d2a'
|
7
|
+
data.tar.gz: e9d86f55d916c7b2d4b4cd2bd9d8161caf089733df76811a3e735cee1b5f1a0c777406fde3599879e0a04774b88274853ee5c598200481a2782f3e7fbda07b50
|
data/CHANGELOG.md
CHANGED
@@ -11,7 +11,13 @@ Prefix your message with one of the following:
|
|
11
11
|
- [Security] in case of vulnerabilities.
|
12
12
|
-->
|
13
13
|
|
14
|
-
##
|
14
|
+
## 2.0.1
|
15
|
+
|
16
|
+
- [Removed] Support for old format.
|
17
|
+
- [Added] Support for custom base scope targeting controller or controller +
|
18
|
+
action.
|
19
|
+
|
20
|
+
## 2.0.0
|
15
21
|
|
16
22
|
- [Added] Add support for placeholders in base title.
|
17
23
|
- [Changed] Set minimum ruby version to 3.2.
|
data/lib/page_meta/base.rb
CHANGED
@@ -78,13 +78,13 @@ module PageMeta
|
|
78
78
|
|
79
79
|
# The title translation.
|
80
80
|
def title
|
81
|
-
@title ||= Translator.new(:
|
81
|
+
@title ||= Translator.new(:title, naming, store)
|
82
82
|
end
|
83
83
|
|
84
84
|
# The description translation.
|
85
85
|
def description(html: false)
|
86
86
|
@description[html] ||= Translator.new(
|
87
|
-
:
|
87
|
+
:description,
|
88
88
|
naming,
|
89
89
|
store.merge(html:)
|
90
90
|
)
|
data/lib/page_meta/translator.rb
CHANGED
@@ -13,31 +13,34 @@ module PageMeta
|
|
13
13
|
@options = options
|
14
14
|
end
|
15
15
|
|
16
|
-
def singular_scope
|
17
|
-
@singular_scope ||= if scope == :keywords
|
18
|
-
"keywords"
|
19
|
-
else
|
20
|
-
scope.to_s.singularize
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
16
|
def to_s
|
25
17
|
return "" if simple.blank?
|
26
18
|
|
27
19
|
value = simple
|
28
20
|
|
29
21
|
[
|
30
|
-
|
31
|
-
t(
|
32
|
-
|
22
|
+
# Set base scope for controller
|
23
|
+
t(
|
24
|
+
"page_meta.#{naming.controller}.#{scope}_base",
|
25
|
+
value:,
|
26
|
+
**override_options
|
27
|
+
),
|
28
|
+
|
29
|
+
# Set base scope for action
|
30
|
+
t(
|
31
|
+
"page_meta.#{naming.controller}.#{naming.action}.#{scope}_base",
|
32
|
+
value:,
|
33
|
+
**override_options
|
34
|
+
),
|
35
|
+
|
36
|
+
# Set base scope
|
37
|
+
t("page_meta.#{scope}_base", value:, **override_options,
|
38
|
+
default: value)
|
33
39
|
].reject(&:blank?).first || ""
|
34
40
|
end
|
35
41
|
|
36
42
|
def translation_scope
|
37
|
-
[
|
38
|
-
"page_meta.#{scope}.#{naming.controller}.#{naming.action}",
|
39
|
-
"page_meta.#{naming.controller}.#{naming.action}.#{singular_scope}"
|
40
|
-
]
|
43
|
+
["page_meta.#{naming.controller}.#{naming.action}.#{scope}"]
|
41
44
|
end
|
42
45
|
|
43
46
|
def override_options
|
data/lib/page_meta/version.rb
CHANGED