rich_i18n 1.2.3 → 1.3.0
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 +1 -1
- data/README.textile +56 -29
- data/Rakefile +22 -8
- data/VERSION +1 -1
- data/{lib/app → app}/views/rich_i18n.html.erb +0 -0
- data/{lib/assets → assets}/jzip/jquery/core.jz +0 -0
- data/{lib/assets → assets}/jzip/jquery/extensions/modules.js +0 -0
- data/{lib/assets → assets}/jzip/jquery/seat_holder.js +31 -31
- data/{lib/assets → assets}/jzip/rich.js +0 -0
- data/{lib/assets → assets}/jzip/rich/i18n.js +2 -2
- data/{lib/assets → assets}/jzip/rich_i18n.jz +0 -0
- data/lib/generators/rich.rb +25 -0
- data/lib/generators/rich/translation/templates/migration.rb +18 -0
- data/lib/generators/rich/translation/templates/model.rb +7 -0
- data/lib/generators/rich/translation/translation_generator.rb +59 -0
- data/lib/rich/i18n.rb +2 -2
- data/lib/rich/i18n/actionpack.rb +0 -1
- data/lib/rich/i18n/actionpack/action_controller/base.rb +3 -3
- data/lib/rich/i18n/actionpack/action_view/base.rb +3 -3
- data/lib/rich/i18n/actionpack/action_view/sanitizor.rb +14 -20
- data/lib/rich/i18n/activesupport.rb +1 -0
- data/lib/rich/i18n/activesupport/active_support/dependencies.rb +12 -0
- data/lib/rich/i18n/core/array.rb +0 -2
- data/lib/rich/i18n/core/array/merging.rb +5 -7
- data/lib/rich/i18n/core/enriched_string.rb +68 -25
- data/lib/rich/i18n/core/object.rb +2 -2
- data/lib/rich/i18n/core/object/enriched.rb +16 -0
- data/lib/rich/i18n/core/string.rb +4 -2
- data/lib/rich/i18n/core/{object/output.rb → string/enriched.rb} +8 -8
- data/lib/rich/i18n/core/string/html_safe.rb +18 -0
- data/lib/rich/i18n/core/string/inflections.rb +9 -9
- data/lib/rich/i18n/core/string/internationalization.rb +20 -18
- data/lib/rich/i18n/core/symbol/internationalization.rb +2 -2
- data/lib/rich/i18n/engine.rb +71 -61
- data/lib/rich/i18n/formtastic.rb +15 -13
- data/lib/rich/i18n/rails.rb +1 -0
- data/lib/rich/i18n/rails/engine.rb +5 -0
- data/lib/rich_i18n.rb +3 -3
- data/locales/nl.yml +3 -3
- data/rails_generators/rich_i18n_translation/rich_i18n_translation_generator.rb +3 -3
- data/rails_generators/rich_i18n_translation/templates/migration.rb +1 -1
- data/rails_generators/rich_i18n_translation/templates/model.rb +2 -2
- data/rich_i18n.gemspec +159 -33
- data/test/rails-2/dummy/Gemfile +5 -0
- data/test/rails-2/dummy/Gemfile.lock +50 -0
- data/test/rails-2/dummy/Rakefile +10 -0
- data/test/rails-2/dummy/app/controllers/application_controller.rb +10 -0
- data/test/rails-2/dummy/app/helpers/application_helper.rb +3 -0
- data/test/rails-2/dummy/config/boot.rb +124 -0
- data/test/rails-2/dummy/config/database.yml +22 -0
- data/test/rails-2/dummy/config/environment.rb +41 -0
- data/test/rails-2/dummy/config/environments/development.rb +17 -0
- data/test/rails-2/dummy/config/environments/production.rb +28 -0
- data/test/rails-2/dummy/config/environments/test.rb +28 -0
- data/test/rails-2/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails-2/dummy/config/initializers/cookie_verification_secret.rb +7 -0
- data/test/rails-2/dummy/config/initializers/inflections.rb +10 -0
- data/test/rails-2/dummy/config/initializers/mime_types.rb +5 -0
- data/test/rails-2/dummy/config/initializers/new_rails_defaults.rb +21 -0
- data/test/rails-2/dummy/config/initializers/session_store.rb +15 -0
- data/test/rails-2/dummy/config/locales/en.yml +5 -0
- data/test/rails-2/dummy/config/preinitializer.rb +20 -0
- data/test/rails-2/dummy/config/routes.rb +43 -0
- data/test/rails-2/dummy/db/seeds.rb +7 -0
- data/test/rails-2/dummy/db/test.sqlite3 +0 -0
- data/test/rails-2/dummy/log/development.log +0 -0
- data/test/rails-2/dummy/log/production.log +0 -0
- data/test/rails-2/dummy/log/server.log +0 -0
- data/test/rails-2/dummy/log/test.log +0 -0
- data/test/rails-2/dummy/public/404.html +30 -0
- data/test/rails-2/dummy/public/422.html +30 -0
- data/test/rails-2/dummy/public/500.html +30 -0
- data/test/rails-2/dummy/public/favicon.ico +0 -0
- data/test/rails-2/dummy/public/images/rails.png +0 -0
- data/test/rails-2/dummy/public/index.html +275 -0
- data/test/rails-2/dummy/public/javascripts/application.js +2 -0
- data/test/rails-2/dummy/public/javascripts/controls.js +963 -0
- data/test/rails-2/dummy/public/javascripts/dragdrop.js +973 -0
- data/test/rails-2/dummy/public/javascripts/effects.js +1128 -0
- data/test/rails-2/dummy/public/javascripts/prototype.js +4320 -0
- data/test/rails-2/dummy/public/robots.txt +5 -0
- data/test/rails-2/dummy/script/about +4 -0
- data/test/rails-2/dummy/script/console +3 -0
- data/test/rails-2/dummy/script/dbconsole +3 -0
- data/test/rails-2/dummy/script/destroy +3 -0
- data/test/rails-2/dummy/script/generate +3 -0
- data/test/rails-2/dummy/script/performance/benchmarker +3 -0
- data/test/rails-2/dummy/script/performance/profiler +3 -0
- data/test/rails-2/dummy/script/plugin +3 -0
- data/test/rails-2/dummy/script/runner +3 -0
- data/test/rails-2/dummy/script/server +3 -0
- data/test/rails-2/test_helper.rb +5 -0
- data/test/rails-3/dummy/Gemfile +5 -0
- data/test/rails-3/dummy/Gemfile.lock +93 -0
- data/test/rails-3/dummy/Rakefile +7 -0
- data/test/rails-3/dummy/app/controllers/application_controller.rb +3 -0
- data/test/rails-3/dummy/app/helpers/application_helper.rb +2 -0
- data/test/rails-3/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/rails-3/dummy/config.ru +4 -0
- data/test/rails-3/dummy/config/application.rb +44 -0
- data/test/rails-3/dummy/config/boot.rb +10 -0
- data/test/rails-3/dummy/config/database.yml +22 -0
- data/test/rails-3/dummy/config/environment.rb +5 -0
- data/test/rails-3/dummy/config/environments/development.rb +26 -0
- data/test/rails-3/dummy/config/environments/production.rb +49 -0
- data/test/rails-3/dummy/config/environments/test.rb +35 -0
- data/test/rails-3/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails-3/dummy/config/initializers/inflections.rb +10 -0
- data/test/rails-3/dummy/config/initializers/mime_types.rb +5 -0
- data/test/rails-3/dummy/config/initializers/secret_token.rb +7 -0
- data/test/rails-3/dummy/config/initializers/session_store.rb +8 -0
- data/test/rails-3/dummy/config/locales/en.yml +5 -0
- data/test/rails-3/dummy/config/routes.rb +58 -0
- data/test/rails-3/dummy/db/test.sqlite3 +0 -0
- data/test/rails-3/dummy/log/development.log +0 -0
- data/test/rails-3/dummy/log/production.log +0 -0
- data/test/rails-3/dummy/log/server.log +0 -0
- data/test/rails-3/dummy/log/test.log +0 -0
- data/test/rails-3/dummy/public/404.html +26 -0
- data/test/rails-3/dummy/public/422.html +26 -0
- data/test/rails-3/dummy/public/500.html +26 -0
- data/test/rails-3/dummy/public/favicon.ico +0 -0
- data/test/rails-3/dummy/public/javascripts/application.js +2 -0
- data/test/rails-3/dummy/public/javascripts/controls.js +965 -0
- data/test/rails-3/dummy/public/javascripts/dragdrop.js +974 -0
- data/test/rails-3/dummy/public/javascripts/effects.js +1123 -0
- data/test/rails-3/dummy/public/javascripts/prototype.js +6001 -0
- data/test/rails-3/dummy/public/javascripts/rails.js +175 -0
- data/test/rails-3/dummy/public/stylesheets/.gitkeep +0 -0
- data/test/rails-3/dummy/script/rails +6 -0
- data/test/rails-3/test_helper.rb +8 -0
- data/test/tests/core/array/merging_test.rb +14 -0
- data/test/tests/core/enriched_string_test.rb +20 -0
- data/test/tests/core/string/inflections_test.rb +32 -0
- data/test/tests/core/string/merging_test.rb +15 -0
- data/test/tests/locales/nl/internationalization_test.rb +55 -0
- metadata +183 -44
- data/lib/rich/i18n/actionpack/action_controller/dispatcher.rb +0 -12
- data/lib/rich/i18n/core/enumerable/methods.rb +0 -16
- data/lib/rich/i18n/core/hash.rb +0 -6
- data/lib/rich/i18n/core/nil_class.rb +0 -8
- data/lib/rich/i18n/core/string/enrichments.rb +0 -66
- data/test/core/string/inflections_test.rb +0 -42
- data/test/core/string/internationalization_test.rb +0 -23
- data/test/engine_test.rb +0 -20
- data/test/locales/nl/internationalization_test.rb +0 -47
- data/test/setup.rb +0 -14
- data/test/test_helper.rb +0 -5
data/CHANGELOG
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
= Rich-i18n CHANGELOG
|
|
2
2
|
|
|
3
|
-
== Version 1.2.3 (October
|
|
3
|
+
== Version 1.2.3 (October 20, 2010)
|
|
4
4
|
|
|
5
5
|
* Using SeatHolder v0.8.8 in order to tell SeatHolder not to react on focus events (yay!)
|
|
6
6
|
* Corrected Rich.I18n.afterUpdate() so certain page elements will be updated again after updating translations
|
data/README.textile
CHANGED
|
@@ -35,50 +35,46 @@ h3. More available features when using E9s (enrichments)
|
|
|
35
35
|
|
|
36
36
|
h2. Installation
|
|
37
37
|
|
|
38
|
-
h3. Using Rich-i18n as gem
|
|
38
|
+
h3. Using Rich-i18n as gem in Rails 3
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Add Rich-i18n in @Gemfile@ as a gem dependency:
|
|
41
41
|
|
|
42
42
|
<pre>
|
|
43
|
-
|
|
43
|
+
gem "rich_i18n"
|
|
44
44
|
</pre>
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
Run the following in your console to install with Bundler:
|
|
47
47
|
|
|
48
48
|
<pre>
|
|
49
|
-
|
|
49
|
+
bundle install
|
|
50
50
|
</pre>
|
|
51
51
|
|
|
52
|
-
h3. Using Rich-i18n as
|
|
52
|
+
h3. Using Rich-i18n as gem in Rails 2
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Add Rich-i18n in @environment.rb@ as a gem dependency:
|
|
55
55
|
|
|
56
56
|
<pre>
|
|
57
|
-
|
|
57
|
+
config.gem "rich_i18n"
|
|
58
58
|
</pre>
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
Run the following in your console:
|
|
61
61
|
|
|
62
62
|
<pre>
|
|
63
|
-
sudo
|
|
63
|
+
sudo rake gems:install
|
|
64
64
|
</pre>
|
|
65
65
|
|
|
66
|
-
h3.
|
|
67
|
-
|
|
68
|
-
You will have to install the @Formtastic@ plugin when translating @labels@ and @seatholders@ with *Rich-i18n as plugin*:
|
|
66
|
+
h3. Using Rich-i18n as plugin in Rails 3
|
|
69
67
|
|
|
70
68
|
<pre>
|
|
71
|
-
|
|
69
|
+
rails plugin install git://github.com/archan937/rich_i18n.git
|
|
72
70
|
</pre>
|
|
73
71
|
|
|
74
|
-
|
|
72
|
+
h3. Using Rich-i18n as plugin in Rails 2
|
|
75
73
|
|
|
76
74
|
<pre>
|
|
77
|
-
|
|
75
|
+
script/plugin install git://github.com/archan937/rich_i18n.git
|
|
78
76
|
</pre>
|
|
79
77
|
|
|
80
|
-
*Note*: please visit "http://github.com/archan937/seat_holder":http://github.com/archan937/seat_holder for more information about SeatHolder.
|
|
81
|
-
|
|
82
78
|
h3. Testing Rich-i18n out-of-the-box
|
|
83
79
|
|
|
84
80
|
Run the Rails console:
|
|
@@ -96,6 +92,38 @@ Start translating in Dutch:
|
|
|
96
92
|
=> "Man / Vrouw"
|
|
97
93
|
</pre>
|
|
98
94
|
|
|
95
|
+
h2. Use the provided Rails generators
|
|
96
|
+
|
|
97
|
+
Rich-i18n requires the following entity:
|
|
98
|
+
|
|
99
|
+
* An @ActiveRecord@ model used for translations storage
|
|
100
|
+
|
|
101
|
+
Fortunately, Rich-i18n is provided with a Rails generator with which you can generate the entity.
|
|
102
|
+
|
|
103
|
+
h4. In Rails 3
|
|
104
|
+
|
|
105
|
+
Run the following in your console:
|
|
106
|
+
|
|
107
|
+
<pre>
|
|
108
|
+
rails g rich:translation -m
|
|
109
|
+
</pre>
|
|
110
|
+
|
|
111
|
+
*Note*: At default, it will create the @Translation@ class and @CreateTranslations@ migration. You can alter the class names with the following:
|
|
112
|
+
|
|
113
|
+
<pre>
|
|
114
|
+
rails g rich:translation CodeHeroes::Translation -m
|
|
115
|
+
</pre>
|
|
116
|
+
|
|
117
|
+
*Note*: The generator has the @-m@ or @--migrate@ option which runs @rake db:migrate@ after creating the files.
|
|
118
|
+
|
|
119
|
+
h4. In Rails 2
|
|
120
|
+
|
|
121
|
+
Run the following in your console:
|
|
122
|
+
|
|
123
|
+
<pre>
|
|
124
|
+
script/generate rich_i18n_translation -m
|
|
125
|
+
</pre>
|
|
126
|
+
|
|
99
127
|
h2. Usage
|
|
100
128
|
|
|
101
129
|
Just call the @t@ method on string or symbols to translate using Rich-i18n.
|
|
@@ -109,7 +137,7 @@ At default, I18n uses @I18n::Backend::Simple@ of which translations are stored w
|
|
|
109
137
|
<pre>
|
|
110
138
|
---
|
|
111
139
|
nl:
|
|
112
|
-
|
|
140
|
+
|
|
113
141
|
word:
|
|
114
142
|
"yes": ja
|
|
115
143
|
"no": nee
|
|
@@ -203,32 +231,32 @@ You can translate @labels@ and @seatholders@ (placeholders :D) within Formtastic
|
|
|
203
231
|
<pre>
|
|
204
232
|
---
|
|
205
233
|
nl:
|
|
206
|
-
|
|
234
|
+
|
|
207
235
|
word:
|
|
208
236
|
password: wachtwoord
|
|
209
|
-
|
|
237
|
+
|
|
210
238
|
label:
|
|
211
239
|
user_name: gebruikersnaam
|
|
212
240
|
content: bericht
|
|
213
|
-
|
|
241
|
+
|
|
214
242
|
Question:
|
|
215
243
|
content: jouw vraag
|
|
216
|
-
|
|
244
|
+
|
|
217
245
|
Answer:
|
|
218
246
|
content: jouw antwoord
|
|
219
|
-
|
|
247
|
+
|
|
220
248
|
(search_form)
|
|
221
249
|
criteria: uw zoekcriteria
|
|
222
|
-
|
|
250
|
+
|
|
223
251
|
seatholder:
|
|
224
252
|
email_address: uw.naam@een.website.nl
|
|
225
|
-
|
|
253
|
+
|
|
226
254
|
Question:
|
|
227
255
|
content: Hoeveel uren zitten in een dag?
|
|
228
|
-
|
|
256
|
+
|
|
229
257
|
Answer:
|
|
230
258
|
content: 24 uur
|
|
231
|
-
|
|
259
|
+
|
|
232
260
|
(search_form)
|
|
233
261
|
criteria: '&Voorbeeld'
|
|
234
262
|
</pre>
|
|
@@ -263,7 +291,6 @@ h2. ToDo's
|
|
|
263
291
|
* Handle the click on inputs with seatholders better
|
|
264
292
|
* Use a better implementation to tackle String interpolation (e.g. "foo #{"bar".t}") to preserve meta data
|
|
265
293
|
* Most String inflection methods are also defined in rich_pluralization (keep it DRY)
|
|
266
|
-
* Make Rich-i18n compatible with Rails 3
|
|
267
294
|
|
|
268
295
|
h2. Enrichments
|
|
269
296
|
|
data/Rakefile
CHANGED
|
@@ -12,10 +12,11 @@ begin
|
|
|
12
12
|
gemspec.homepage = "http://codehero.es/rails_gems_plugins/rich_i18n"
|
|
13
13
|
gemspec.author = "Paul Engel"
|
|
14
14
|
|
|
15
|
-
gemspec.add_dependency "
|
|
15
|
+
gemspec.add_dependency "authlogic" , ">= 2.1.2"
|
|
16
|
+
gemspec.add_dependency "formtastic", ">= 1.1.0"
|
|
16
17
|
gemspec.add_dependency "hpricot"
|
|
17
18
|
gemspec.add_dependency "i18n" , ">= 0.3.7"
|
|
18
|
-
gemspec.add_dependency "jzip" , ">= 1.0.
|
|
19
|
+
gemspec.add_dependency "jzip" , ">= 1.0.11"
|
|
19
20
|
end
|
|
20
21
|
Jeweler::GemcutterTasks.new
|
|
21
22
|
rescue LoadError
|
|
@@ -25,12 +26,25 @@ end
|
|
|
25
26
|
desc "Default: run unit tests."
|
|
26
27
|
task :default => :test
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
Rake::
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
task :test do
|
|
30
|
+
Rake::Task["test:rails3"].execute
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
namespace :test do
|
|
34
|
+
desc "Test the rich_i18n plugin in Rails 2."
|
|
35
|
+
Rake::TestTask.new(:rails2) do |t|
|
|
36
|
+
t.libs << "lib"
|
|
37
|
+
t.libs << "test"
|
|
38
|
+
t.pattern = "test/rails-2/{,/*/**}/*_test.rb"
|
|
39
|
+
t.verbose = true
|
|
40
|
+
end
|
|
41
|
+
desc "Test the rich_i18n plugin in Rails 3."
|
|
42
|
+
Rake::TestTask.new(:rails3) do |t|
|
|
43
|
+
t.libs << "lib"
|
|
44
|
+
t.libs << "test"
|
|
45
|
+
t.pattern = "test/rails-3/{,/*/**}/*_test.rb"
|
|
46
|
+
t.verbose = true
|
|
47
|
+
end
|
|
34
48
|
end
|
|
35
49
|
|
|
36
50
|
desc "Generate documentation for the rich_i18n plugin."
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.3.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -15,19 +15,19 @@ if (typeof(SeatHolder) == "undefined") {
|
|
|
15
15
|
|
|
16
16
|
SeatHolder = (function() {
|
|
17
17
|
var hintClass = "sh_hint", hideClass = "sh_hide", ignored_types = ["file", "submit"], reacting = true;
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
var injectCode = function() {
|
|
20
|
-
var style = "<style>" +
|
|
20
|
+
var style = "<style>" +
|
|
21
21
|
"." + hintClass + " { color: " + SeatHolder.hintColor +" !important } " +
|
|
22
22
|
"." + hideClass + " { display: none !important }" +
|
|
23
23
|
"</style>";
|
|
24
24
|
|
|
25
25
|
jQuery(style).prependTo("head");
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
var bind = function() {
|
|
29
29
|
var hintedElements = [];
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
jQuery.each(jQuery(SeatHolder.selector), function(i, element) {
|
|
32
32
|
element = jQuery(element);
|
|
33
33
|
var seatholder = element.attr("seatholder");
|
|
@@ -41,11 +41,11 @@ SeatHolder = (function() {
|
|
|
41
41
|
} else {
|
|
42
42
|
hintedElements.push(element);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
element.focus(onFocus)
|
|
46
46
|
.blur(onBlur);
|
|
47
47
|
});
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
jQuery.each(hintedElements, function(i, element) {
|
|
50
50
|
element = jQuery(element);
|
|
51
51
|
var hintElement = element.data("hint_element");
|
|
@@ -57,61 +57,61 @@ SeatHolder = (function() {
|
|
|
57
57
|
.attr("readonly", true)
|
|
58
58
|
.data("hinted_element", element)
|
|
59
59
|
.focus(onHintFocus);
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
jQuery.each(element.get(0).attributes, function(index, attribute) {
|
|
62
62
|
var key = attribute.name;
|
|
63
63
|
var value = attribute.value;
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
if ((jQuery.inArray(key, ["class", "size", "cols", "rows", "style"]) != -1) || key.match(/^data-/)) {
|
|
66
66
|
switch(attribute) {
|
|
67
67
|
case "class":
|
|
68
68
|
hintElement.attr(key, value.replace(hideClass, "")); break;
|
|
69
69
|
default:
|
|
70
70
|
hintElement.attr(key, value);
|
|
71
|
-
}
|
|
71
|
+
}
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
hintElement.addClass(hintClass);
|
|
76
76
|
element.data("hint_element", hintElement)
|
|
77
77
|
.before(hintElement);
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
hintElement.val(element.attr("seatholder"));
|
|
81
81
|
onBlur(null, element);
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
var react = function(bool) {
|
|
86
86
|
reacting = typeof(bool) == "undefined" ? true : bool;
|
|
87
87
|
};
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
var onHintFocus = function(event) {
|
|
90
90
|
if (!reacting) {
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
var hintElement = jQuery(event.target).addClass(hideClass);
|
|
95
|
-
|
|
95
|
+
|
|
96
96
|
hintElement.data("hinted_element")
|
|
97
97
|
.removeClass(hideClass)
|
|
98
98
|
.focus();
|
|
99
99
|
};
|
|
100
|
-
|
|
100
|
+
|
|
101
101
|
var onFocus = function(event) {
|
|
102
102
|
if (!reacting) {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
var element = jQuery(event.target);
|
|
107
107
|
var seatholder = element.attr("seatholder");
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
if (element.val() == seatholder.replace(/^&/, "")) {
|
|
110
110
|
element.val("");
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
var input = element.get(0);
|
|
114
|
-
|
|
114
|
+
|
|
115
115
|
if (input.createTextRange) {
|
|
116
116
|
var oRange = input.createTextRange();
|
|
117
117
|
oRange.moveStart("character", 0);
|
|
@@ -121,25 +121,25 @@ SeatHolder = (function() {
|
|
|
121
121
|
input.setSelectionRange(0, element.val().length);
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
|
-
|
|
124
|
+
|
|
125
125
|
var onBlur = function(event, element) {
|
|
126
126
|
if (element == null) {
|
|
127
127
|
element = jQuery(event.target);
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
|
|
130
130
|
var seatholder = element.attr("seatholder");
|
|
131
131
|
var hintElement = element.data("hint_element");
|
|
132
132
|
if (typeof(hintElement) == "undefined") {
|
|
133
133
|
hintElement = null;
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
|
|
136
136
|
if ((element.val().length > 0 && element.val() != seatholder.replace(/^&/, ""))) {
|
|
137
137
|
if (hintElement) {
|
|
138
|
-
|
|
138
|
+
hintElement.addClass(hideClass);
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
return;
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
if (seatholder.match(/^&/)) {
|
|
144
144
|
element.val(seatholder.replace(/^&/, ""));
|
|
145
145
|
} else {
|
|
@@ -148,7 +148,7 @@ SeatHolder = (function() {
|
|
|
148
148
|
hintElement.removeClass(hideClass);
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
|
-
|
|
151
|
+
|
|
152
152
|
return {
|
|
153
153
|
version: "0.8.8",
|
|
154
154
|
selector: "[seatholder]",
|
|
@@ -169,11 +169,11 @@ SeatHolder = (function() {
|
|
|
169
169
|
|
|
170
170
|
(function requireMissingLibs() {
|
|
171
171
|
var missing_libs = [];
|
|
172
|
-
|
|
172
|
+
|
|
173
173
|
if (typeof(jQuery) == "undefined") {
|
|
174
174
|
missing_libs.push("core");
|
|
175
175
|
}
|
|
176
|
-
|
|
176
|
+
|
|
177
177
|
if (missing_libs.length == 0) {
|
|
178
178
|
SeatHolder.init();
|
|
179
179
|
} else {
|
|
@@ -186,9 +186,9 @@ SeatHolder = (function() {
|
|
|
186
186
|
element = element.previousSibling;
|
|
187
187
|
}
|
|
188
188
|
dummyScript.parentNode.removeChild(dummyScript);
|
|
189
|
-
|
|
189
|
+
|
|
190
190
|
var src = element.getAttribute("src").replace(/(development\/)?(\w+)(\-min)?\.js.*$/, "jquery/" + missing_libs.sort().join(".") + ".js");
|
|
191
|
-
document.write('<script src="' + src + '" type="text/javascript" ' +
|
|
191
|
+
document.write('<script src="' + src + '" type="text/javascript" ' +
|
|
192
192
|
'onload="SeatHolder.init()" onreadystatechange="SeatHolder.init()">' +
|
|
193
193
|
'</script>');
|
|
194
194
|
}
|
|
File without changes
|
|
@@ -3,11 +3,11 @@ Rich.I18n = (function() {
|
|
|
3
3
|
return {
|
|
4
4
|
beforeEdit: function(inputs, selector, specs, identifier) {
|
|
5
5
|
var translated_keys = $("<input name='content_item[derivative_keys]' type='hidden'/>")
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
translated_keys.val($(identifier).map(function() {
|
|
8
8
|
return $(this).attr("data-derivative_key");
|
|
9
9
|
}).toArray().join(";"));
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
inputs.append(translated_keys);
|
|
12
12
|
},
|
|
13
13
|
afterUpdate: function(form, response, selector, specs, identifier) {
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require "rails/generators/named_base"
|
|
2
|
+
|
|
3
|
+
module Rich
|
|
4
|
+
module Generators
|
|
5
|
+
|
|
6
|
+
class Base < Rails::Generators::Base
|
|
7
|
+
def self.source_root
|
|
8
|
+
File.expand_path File.join(File.dirname(__FILE__), "rich", generator_name, "templates")
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module Migration
|
|
13
|
+
def self.included(base)
|
|
14
|
+
base.extend ClassMethods
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
module ClassMethods
|
|
18
|
+
def next_migration_number(dirname)
|
|
19
|
+
Time.now.strftime "%Y%m%d%H%M%S"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|