phrasing 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -1
- data/Gemfile.lock +21 -3
- data/app/assets/javascripts/phrasing.js.erb +0 -1
- data/app/assets/stylesheets/phrasing_edit_mode_bubble.css.scss +6 -0
- data/app/helpers/inline_helper.rb +1 -1
- data/app/models/phrasing_phrase.rb +16 -7
- data/lib/phrasing/implementation.rb +3 -6
- data/lib/phrasing/version.rb +1 -1
- data/phrasing.gemspec +2 -0
- data/spec/dummy/app/views/site/index.html.erb +2 -0
- data/spec/dummy/config/locales/en.yml +1 -0
- data/spec/dummy/log/test.log +55916 -0
- data/spec/features/dummy_spec.rb +23 -9
- metadata +33 -47
- data/app/assets/javascripts/spin.js +0 -355
- data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1524a8ae0986ae8836d789001277cb2a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2577540db9b91552e445c6f71fe549a5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5e5dccf46135893ba5aa04b2f6dcb9c2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/61d7673b6096c7fe71678968db1270e8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/668ce79999306d7c256f7c849c29384a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7f0eeee40ad7d0ee3deb01c58a3c9604 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9bb92a90f001d659da46cceb6760405d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b247b072c0cb3d44ce31c524e74253c9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e1058f33db77649b2d01d1c4e7a32cbc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e64cfbce519bf7c3f6b387e85dabc7b7 +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c7efc7bcebc790fc33dc2ad4a7364d2bd08b7d35
|
4
|
+
data.tar.gz: aeba9e1bb51923ad1bc3237378cc5806a15c5ff2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 25e0c5c1a418044a56c768eb831ac06b18d1293632d1c216734cdde54c0a3ee041ba7492e978ea9086468c7f379721fa8d5833b54b0838210c2519666d8f0c14
|
7
|
+
data.tar.gz: e8d102720009260e083de23a020f26b315ceb64c486349f03a5b45cf6c43f8d31ff280bfd85db1824fac3016d54428cb3215f901d2ff3dcbbdaee467dde36dca
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
phrasing (3.
|
4
|
+
phrasing (3.2.1)
|
5
5
|
haml-rails
|
6
6
|
jquery-cookie-rails
|
7
7
|
jquery-rails
|
@@ -48,6 +48,14 @@ GEM
|
|
48
48
|
xpath (~> 1.0.0)
|
49
49
|
childprocess (0.3.9)
|
50
50
|
ffi (~> 1.0, >= 1.0.11)
|
51
|
+
coderay (1.1.0)
|
52
|
+
columnize (0.3.6)
|
53
|
+
debugger (1.6.5)
|
54
|
+
columnize (>= 0.3.1)
|
55
|
+
debugger-linecache (~> 1.2.0)
|
56
|
+
debugger-ruby_core_source (~> 1.3.1)
|
57
|
+
debugger-linecache (1.2.0)
|
58
|
+
debugger-ruby_core_source (1.3.1)
|
51
59
|
diff-lcs (1.2.4)
|
52
60
|
erubis (2.7.0)
|
53
61
|
factory_girl (4.2.0)
|
@@ -73,6 +81,7 @@ GEM
|
|
73
81
|
mail (2.5.4)
|
74
82
|
mime-types (~> 1.16)
|
75
83
|
treetop (~> 1.4.8)
|
84
|
+
method_source (0.8.2)
|
76
85
|
mime-types (1.24)
|
77
86
|
mini_portile (0.5.1)
|
78
87
|
minitest (4.7.5)
|
@@ -80,6 +89,13 @@ GEM
|
|
80
89
|
nokogiri (1.6.0)
|
81
90
|
mini_portile (~> 0.5.0)
|
82
91
|
polyglot (0.3.3)
|
92
|
+
pry (0.9.12.4)
|
93
|
+
coderay (~> 1.0)
|
94
|
+
method_source (~> 0.8)
|
95
|
+
slop (~> 3.4)
|
96
|
+
pry-debugger (0.2.2)
|
97
|
+
debugger (~> 1.3)
|
98
|
+
pry (~> 0.9.10)
|
83
99
|
rack (1.5.2)
|
84
100
|
rack-test (0.6.2)
|
85
101
|
rack (>= 1.0)
|
@@ -109,13 +125,14 @@ GEM
|
|
109
125
|
rspec-expectations (~> 2.14.0)
|
110
126
|
rspec-mocks (~> 2.14.0)
|
111
127
|
rubyzip (0.9.9)
|
112
|
-
sass (3.2.
|
128
|
+
sass (3.2.13)
|
113
129
|
selenium-webdriver (2.35.0)
|
114
130
|
childprocess (>= 0.2.5)
|
115
131
|
multi_json (~> 1.0)
|
116
132
|
rubyzip
|
117
133
|
websocket (~> 1.0.4)
|
118
|
-
|
134
|
+
slop (3.4.7)
|
135
|
+
sprockets (2.10.1)
|
119
136
|
hike (~> 1.2)
|
120
137
|
multi_json (~> 1.0)
|
121
138
|
rack (~> 1.0)
|
@@ -145,5 +162,6 @@ DEPENDENCIES
|
|
145
162
|
factory_girl_rails
|
146
163
|
haml-rails
|
147
164
|
phrasing!
|
165
|
+
pry-debugger
|
148
166
|
rspec-rails
|
149
167
|
sqlite3
|
@@ -37,7 +37,7 @@ module InlineHelper
|
|
37
37
|
def phrasing_phrase(key, options = {})
|
38
38
|
key = key.to_s
|
39
39
|
if can_edit_phrases?
|
40
|
-
@record = PhrasingPhrase.where(key: key, locale: I18n.locale.to_s).first || PhrasingPhrase.
|
40
|
+
@record = PhrasingPhrase.where(key: key, locale: I18n.locale.to_s).first || PhrasingPhrase.search_i18n_and_create_phrase(key)
|
41
41
|
inline(@record, :value, options || {})
|
42
42
|
else
|
43
43
|
options.try(:[], :interpolation) ? t(key, options[:interpolation]).html_safe : t(key).html_safe
|
@@ -8,13 +8,22 @@ class PhrasingPhrase < ActiveRecord::Base
|
|
8
8
|
|
9
9
|
after_update :version_it
|
10
10
|
|
11
|
-
def self.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
def self.search_i18n_and_create_phrase key
|
12
|
+
begin
|
13
|
+
value = I18n.t key, raise: true
|
14
|
+
PhrasingPhrase.where(key: key, locale: I18n.locale).first
|
15
|
+
rescue I18n::MissingTranslationData
|
16
|
+
create_phrase(key)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.create_phrase key, value = nil
|
21
|
+
phrasing_phrase = PhrasingPhrase.new
|
22
|
+
phrasing_phrase.locale = I18n.locale.to_s
|
23
|
+
phrasing_phrase.key = key.to_s
|
24
|
+
phrasing_phrase.value = value || key.to_s
|
25
|
+
phrasing_phrase.save
|
26
|
+
phrasing_phrase
|
18
27
|
end
|
19
28
|
|
20
29
|
module Serialize
|
@@ -10,12 +10,9 @@ module Phrasing
|
|
10
10
|
return cct.value if cct
|
11
11
|
|
12
12
|
value = super(locale, key, scope, options)
|
13
|
-
if value
|
14
|
-
|
15
|
-
|
16
|
-
phrasing_phrase.key = scoped_key
|
17
|
-
phrasing_phrase.value = value
|
18
|
-
phrasing_phrase.save
|
13
|
+
if value
|
14
|
+
#creation in background no matter if developer user the I18n#t or phrase helper
|
15
|
+
PhrasingPhrase.create_phrase(scoped_key, value)
|
19
16
|
end
|
20
17
|
value
|
21
18
|
end
|
data/lib/phrasing/version.rb
CHANGED
data/phrasing.gemspec
CHANGED