web-connect 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d6d07bce951df691ca0c55dd4aefbcf9820268b
|
4
|
+
data.tar.gz: f9b7d39e82d2c54287615ffbe3cec4cb2bbbcfdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 542d2b415f376a97444957d3703ca2a75a547de472532822f71e1b9a146487eda1a64de6364578e86dfb79111532d2346b30d8596933cdf533bc320e48c43ba1
|
7
|
+
data.tar.gz: 53396060972b9f7c7ddd5ea8270c7335e924802cff72c80d908870d468b54ca0fe9279d6a9cf08aee35fd5d96c497758d36dbe4a49464e75a9fe762d104d9ad0
|
@@ -22,12 +22,38 @@ module Netfira::WebConnect
|
|
22
22
|
shop.locale
|
23
23
|
end
|
24
24
|
|
25
|
+
def [](key)
|
26
|
+
if translated_attribute_names.include? key.to_s
|
27
|
+
get_translated_string key.to_sym
|
28
|
+
else
|
29
|
+
super key
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def []=(key, value)
|
34
|
+
if translated_attribute_names.include? key.to_s
|
35
|
+
set_translated_string key.to_sym, value
|
36
|
+
else
|
37
|
+
super key, value
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
25
41
|
private
|
26
42
|
|
27
43
|
def translations
|
28
44
|
@translations ||= translation_models.map{ |model| [model.language, model]}.to_h
|
29
45
|
end
|
30
46
|
|
47
|
+
def previous_translations
|
48
|
+
Hash.new { |hash, k| hash[k] = {} }.tap do |result|
|
49
|
+
translations.each do |language, translation|
|
50
|
+
translation.changed_attributes.each do |attr, value|
|
51
|
+
result[attr][language] = value if translation.class.translated_attribute_names.include? attr
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
31
57
|
def translated_strings
|
32
58
|
@translated_strings ||= {}
|
33
59
|
end
|
@@ -58,6 +84,10 @@ module Netfira::WebConnect
|
|
58
84
|
self
|
59
85
|
end
|
60
86
|
|
87
|
+
def translated_attribute_names
|
88
|
+
self.class::Translation.translated_attribute_names
|
89
|
+
end
|
90
|
+
|
61
91
|
end
|
62
92
|
end
|
63
93
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web-connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil E. Pearson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|