effective_resources 2.4.0 → 2.4.1
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/app/helpers/effective_resources_helper.rb +15 -4
- data/lib/effective_resources/version.rb +1 -1
- data/lib/effective_resources.rb +13 -3
- 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: 9c82abcba44a0a6d2488c79bef898d95a025eb976112f4a2dcf04821bb3658d3
|
4
|
+
data.tar.gz: 62793269ccfec2f9ec332e85c8b308de04980f89964aff98e20af91adc70bda7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ce34a3a0f0aaa6ecbbe14540ef045e21cc87e32cfee26d1ccb14a1a105e5f386743925b45983cc8c6b217ba228714c35f1d7442c8fdcb971e60ff790dc8f143
|
7
|
+
data.tar.gz: d52c0fdbca5a98fa7cc1719d5343199566604eeab786f1de3bd18f5dedbf9879c150f877d78eb7400ec424cbd601ca53845a5009c392368f1a911ebc4363e0c2
|
@@ -300,15 +300,26 @@ module EffectiveResourcesHelper
|
|
300
300
|
path || '/'
|
301
301
|
end
|
302
302
|
|
303
|
-
|
303
|
+
# effective_translate
|
304
|
+
def et(resource, attribute = nil)
|
304
305
|
EffectiveResources.et(resource, attribute)
|
305
306
|
end
|
306
307
|
|
307
|
-
|
308
|
+
# effective_translate_plural
|
309
|
+
def etd(resource, attribute = nil)
|
310
|
+
EffectiveResources.etd(resource, attribute)
|
311
|
+
end
|
312
|
+
|
313
|
+
# effective_translate_plural
|
314
|
+
def ets(resource, attribute = nil)
|
308
315
|
EffectiveResources.ets(resource, attribute)
|
309
316
|
end
|
310
317
|
|
311
|
-
|
312
|
-
|
318
|
+
# effective_translate_plural
|
319
|
+
def etsd(resource, attribute = nil)
|
320
|
+
EffectiveResources.etsd(resource, attribute)
|
321
|
+
end
|
322
|
+
|
323
|
+
|
313
324
|
|
314
325
|
end
|
data/lib/effective_resources.rb
CHANGED
@@ -179,9 +179,11 @@ module EffectiveResources
|
|
179
179
|
end
|
180
180
|
|
181
181
|
def self.et(resource, attribute = nil)
|
182
|
-
|
183
|
-
|
184
|
-
|
182
|
+
if resource.respond_to?(:model_name) == false
|
183
|
+
value = I18n.t(resource)
|
184
|
+
raise("Missing translation: #{resource}") if value.start_with?('translation missing:')
|
185
|
+
value
|
186
|
+
elsif attribute.blank?
|
185
187
|
resource.model_name.human
|
186
188
|
elsif resource.respond_to?(:human_attribute_name)
|
187
189
|
resource.human_attribute_name(attribute)
|
@@ -190,8 +192,16 @@ module EffectiveResources
|
|
190
192
|
end
|
191
193
|
end
|
192
194
|
|
195
|
+
def self.etd(resource, attribute = nil)
|
196
|
+
et(resource, attribute).downcase
|
197
|
+
end
|
198
|
+
|
193
199
|
def self.ets(resource, attribute = nil)
|
194
200
|
et(resource, attribute).pluralize
|
195
201
|
end
|
196
202
|
|
203
|
+
def self.etsd(resource, attribute = nil)
|
204
|
+
et(resource, attribute).pluralize.downcase
|
205
|
+
end
|
206
|
+
|
197
207
|
end
|