ember-validations-rails-ja 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/javascripts/ember-i18n.js +17 -25
- data/lib/ember-validations-rails-ja/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bae08bbfdf8bf5f23283b5004fa0c8bbdd2376e
|
4
|
+
data.tar.gz: 583f0b56dc824bfb1826ff4ef0e979ffaf64a2ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1b01bfdc2796f086a6db476f2dd3a8fdab39f46525842378de4019914b07be061ae5708b51a12cf8ed5603ce6f908c5730bdcd13c1ae2928d7f4b3564b5cb3c
|
7
|
+
data.tar.gz: 621609d5ceadada9fcc83e1fd86beaf95e49f97c1026c52153e8db77704674e836b910de7cfc88db102356ece09cd977d439aa6da3f6aa4299fec48c329bddf9
|
@@ -109,17 +109,26 @@
|
|
109
109
|
},
|
110
110
|
|
111
111
|
TranslateableProperties: Ember.Mixin.create({
|
112
|
-
|
113
|
-
var
|
112
|
+
_translationObserver: function(sender, propWithSuffix) {
|
113
|
+
var prop = propWithSuffix.replace(/Translation$/, '');
|
114
|
+
set(this, prop, I18n.t(this.get(propWithSuffix)));
|
115
|
+
},
|
116
|
+
|
117
|
+
_addTranslationObservers: function() {
|
114
118
|
eachTranslatedAttribute(this, function(attribute, translation) {
|
115
|
-
this.addObserver(attribute + 'Translation', this,
|
116
|
-
set(this, attribute, I18n.t(this.get(attribute + 'Translation')));
|
117
|
-
});
|
119
|
+
this.addObserver(attribute + 'Translation', this, this._translationObserver);
|
118
120
|
set(this, attribute, translation);
|
119
121
|
});
|
120
|
-
|
121
|
-
|
122
|
-
|
122
|
+
}.on('init'),
|
123
|
+
|
124
|
+
_removeTranslationObservers: function (){
|
125
|
+
eachTranslatedAttribute(this, function(attribute) {
|
126
|
+
var propWithSuffix = attribute + 'Translation';
|
127
|
+
if(this.hasObserverFor(propWithSuffix)) {
|
128
|
+
this.removeObserver(propWithSuffix, this._translationObserver);
|
129
|
+
}
|
130
|
+
});
|
131
|
+
}.on('willDestroyElement','willClearRender')
|
123
132
|
}),
|
124
133
|
|
125
134
|
TranslateableAttributes: Ember.Mixin.create({
|
@@ -139,21 +148,4 @@
|
|
139
148
|
return new EmHandlebars.SafeString(I18n.t(key, options.hash));
|
140
149
|
});
|
141
150
|
|
142
|
-
var attrHelperFunction = function(options) {
|
143
|
-
var attrs, result;
|
144
|
-
attrs = options.hash;
|
145
|
-
result = [];
|
146
|
-
|
147
|
-
Ember.keys(attrs).forEach(function(property) {
|
148
|
-
var translatedValue;
|
149
|
-
translatedValue = I18n.t(attrs[property]);
|
150
|
-
return result.push('%@="%@"'.fmt(property, translatedValue));
|
151
|
-
});
|
152
|
-
|
153
|
-
return new EmHandlebars.SafeString(result.join(' '));
|
154
|
-
};
|
155
|
-
|
156
|
-
EmHandlebars.registerHelper('translateAttr', attrHelperFunction);
|
157
|
-
EmHandlebars.registerHelper('ta', attrHelperFunction);
|
158
|
-
|
159
151
|
}).call(undefined);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ember-validations-rails-ja
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kozo yamagata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|