effective_resources 2.8.7 → 2.8.8
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/MIT-LICENSE +1 -1
- data/app/models/effective/resources/i18n.rb +8 -4
- data/lib/effective_resources/version.rb +1 -1
- data/lib/effective_resources.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a583a70685ae3faf4811c49e750ae55c05aec5af0ed3f061662c80723575a2c9
|
4
|
+
data.tar.gz: acb81962352988b990db0d8b95ba4430d02bfad1bf04946d5724753bf10454ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60bb0ff5c80356b24770eb98d9787a9a975368edf7fa3be6c5cd700c7937e3fce7a6ad1a5d8cf8670184c0b5feeaf0dd98577989948b5292a7f3f4fe09c3ed97
|
7
|
+
data.tar.gz: 1aa740c85b5a07a900e9cc68f97f38dfe0c57b1ca1fbfecf43f34a2b9be2aba8571e84d989a99957c319d33b437da061e56744999d49213d4a9dddf3795f30f4
|
data/MIT-LICENSE
CHANGED
@@ -5,8 +5,10 @@ module Effective
|
|
5
5
|
module I18n
|
6
6
|
def human_action_name(action)
|
7
7
|
if klass.respond_to?(:model_name)
|
8
|
-
|
9
|
-
|
8
|
+
key = "activerecord.actions.#{klass.model_name.i18n_key}.#{action}"
|
9
|
+
|
10
|
+
value = ::I18n.t(key)
|
11
|
+
return value unless value.include?(key) # missing translation
|
10
12
|
end
|
11
13
|
|
12
14
|
if crud_actions.include?(action)
|
@@ -19,8 +21,10 @@ module Effective
|
|
19
21
|
|
20
22
|
def human_action_confirm(action)
|
21
23
|
if klass.respond_to?(:model_name)
|
22
|
-
|
23
|
-
|
24
|
+
key = "activerecord.actions.#{klass.model_name.i18n_key}.#{action}_confirm"
|
25
|
+
|
26
|
+
value = ::I18n.t(key)
|
27
|
+
return value unless value.include?(key) # missing translation
|
24
28
|
end
|
25
29
|
|
26
30
|
"Really #{human_action_name(action)} @resource?"
|
data/lib/effective_resources.rb
CHANGED
@@ -180,12 +180,13 @@ module EffectiveResources
|
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
|
+
# effective_translate
|
183
184
|
def self.et(resource, attribute = nil)
|
184
185
|
if resource.respond_to?(:datatable_name)
|
185
186
|
resource.datatable_name
|
186
|
-
elsif resource.respond_to?(:model_name) == false
|
187
|
+
elsif resource.respond_to?(:model_name) == false # Just a string. Fees will do this
|
187
188
|
value = I18n.t(resource)
|
188
|
-
raise("Missing translation: #{resource}") if value.
|
189
|
+
raise StandardError.new("Missing translation: #{resource}") if value.include?(resource)
|
189
190
|
value
|
190
191
|
elsif attribute.blank?
|
191
192
|
resource.model_name.human
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|