js_erb 0.1.1 → 0.1.2
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.
- data/CHANGELOG.rdoc +8 -0
- data/README.rdoc +1 -1
- data/lib/js_erb/controller.rb +1 -1
- data/lib/js_erb/version.rb +1 -1
- metadata +3 -3
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -43,7 +43,7 @@ At the end set javascript_include_tag (add javascript files into the <head>).
|
|
43
43
|
== Javascript HTML Templates & Translations
|
44
44
|
|
45
45
|
JsErb will, in addition to javascript source files, create a javascript file with translations
|
46
|
-
and javascript file with HTML templates. You can access them
|
46
|
+
and javascript file with HTML templates. You can access them anywhere in your javascript like
|
47
47
|
|
48
48
|
# Access transations
|
49
49
|
alert( i18n.t('welcome') );
|
data/lib/js_erb/controller.rb
CHANGED
@@ -56,7 +56,7 @@ module JsErb
|
|
56
56
|
name = File.basename(file, '.js.yml')
|
57
57
|
content = YAML.load(ERB.new(File.read(file)).result)
|
58
58
|
File.open(File.join(JsErb.config['path']['compiled'], 'locales', "#{name}.js"), "wb") do |f|
|
59
|
-
f.write("window.i18n = {t:function(key){for(var i in i18n.$){return i18n
|
59
|
+
f.write("window.i18n = {t:function(key){for(var i in i18n.$){return eval('i18n.$.'+i+'.'+key)}}, $:#{content.to_json} };")
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
data/lib/js_erb/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js_erb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kristijan Sedlak
|