rao-view_helper 0.0.34.pre → 0.0.35.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/view_helpers/rao/view_helper/base.rb +32 -0
- 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: 218190af06d71f387630ab11de60a24f545e2f42aab60aa6f9fec285798fdef1
|
4
|
+
data.tar.gz: 307ceeb828e8f8dc10b134d5dceccc202d31c2eab6f8f89e65dca0ee586eba27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 541cd6123032e630961cc8465baa9ed50fd0e0b097300f6b8a27843ad3b9db8b4516393b8052ea70410531a523a86f338c32bbd276428722cfe7ae8ffed87a0c
|
7
|
+
data.tar.gz: 1f967ce317af304a66c833c16e379cf9ea707db8efb30b1f69236057232a3d82eb89b5da24725db96fc0413f0f6353a538dcd76846139f83fc75c19527e76fa5
|
@@ -32,6 +32,38 @@ module Rao
|
|
32
32
|
def render(locals = {})
|
33
33
|
c.render partial: "/#{self.class.name.underscore}/#{caller_locations(1,1)[0].label}", locals: locals
|
34
34
|
end
|
35
|
+
|
36
|
+
# You can use scoped translations by using the dot notation.
|
37
|
+
#
|
38
|
+
# Example:
|
39
|
+
#
|
40
|
+
# # app/view_helpers/blog_view_helper.rb
|
41
|
+
# class BlogViewHelper < Rao::ViewHelper::Base
|
42
|
+
# def title
|
43
|
+
# t('.title')
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# # config/locales/en.yml
|
48
|
+
# en:
|
49
|
+
# view_helpers:
|
50
|
+
# blog_view_helper:
|
51
|
+
# title: 'Posts'
|
52
|
+
#
|
53
|
+
# blog_view_helper(self).title
|
54
|
+
# => "Posts"
|
55
|
+
#
|
56
|
+
module I18nConcern
|
57
|
+
def t(key, options = {})
|
58
|
+
if key.start_with?('.')
|
59
|
+
I18n.t("view_helpers.#{self.class.name.underscore}.#{key}", options)
|
60
|
+
else
|
61
|
+
I18n.t(key, options)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
include I18nConcern
|
35
67
|
end
|
36
68
|
end
|
37
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rao-view_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.35.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|