country-select-engine 0.1.2 → 0.2.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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +3 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +66 -71
- data/Rakefile +14 -9
- data/{script → bin}/convert_cldr.rb +0 -0
- data/{script → bin}/google.yml +0 -0
- data/{script → bin}/google.zh-TW.yml +0 -0
- data/{script → bin}/rails +1 -1
- data/{script → bin}/timezones.yml +0 -0
- data/{script → bin}/translate_timezones.rb +0 -0
- data/country-select-engine.gemspec +2 -3
- data/lib/country-select-engine.rb +9 -22
- data/lib/country-select-engine/version.rb +1 -1
- data/test/dummy/README.rdoc +28 -0
- data/{spec → test}/dummy/Rakefile +0 -1
- data/{spec → test}/dummy/app/assets/javascripts/application.js +3 -5
- data/{spec → test}/dummy/app/assets/stylesheets/application.css +1 -1
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/{spec → test}/dummy/app/controllers/dummy_controller.rb +2 -0
- data/{spec → test}/dummy/app/helpers/application_helper.rb +0 -0
- data/{spec → test}/dummy/app/mailers/.gitkeep +0 -0
- data/{spec → test}/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/models/user.rb +2 -0
- data/{spec → test}/dummy/app/views/dummy/index.html.erb +14 -0
- data/{spec → test}/dummy/app/views/layouts/application.html.erb +0 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/{spec → test}/dummy/config.ru +1 -1
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/{spec → test}/dummy/config/database.yml +0 -0
- data/{spec → test}/dummy/config/environment.rb +2 -2
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/{spec → test}/dummy/config/environments/test.rb +13 -14
- data/{spec → test}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/{spec → test}/dummy/config/initializers/inflections.rb +6 -5
- data/{spec → test}/dummy/config/initializers/mime_types.rb +0 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/{spec → test}/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/test/dummy/config/routes.rb +60 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130716075309_create_users.rb +12 -0
- data/test/dummy/db/schema.rb +25 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/{spec → test}/dummy/lib/assets/.gitkeep +0 -0
- data/{spec → test}/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/{spec → test}/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/fixtures/users.yml +13 -0
- data/test/dummy/test/models/user_test.rb +7 -0
- data/{spec → test}/localized_country_select_test.rb +0 -0
- data/{spec → test}/spec_helper.rb +0 -0
- metadata +139 -132
- metadata.gz.sig +0 -0
- data/spec/dummy/README.rdoc +0 -261
- data/spec/dummy/app/assets/javascripts/dummy.js +0 -2
- data/spec/dummy/app/assets/stylesheets/dummy.css +0 -4
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/app/helpers/dummy_helper.rb +0 -2
- data/spec/dummy/config/application.rb +0 -62
- data/spec/dummy/config/boot.rb +0 -10
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -67
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/routes.rb +0 -60
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -25
- data/spec/dummy/script/rails +0 -6
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5d9eefe4d98c7206992dc7d72e72d5d68d05b6cb
|
|
4
|
+
data.tar.gz: d5c3e5fb95d3f285d35b68d23c6745a4df322344
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 069e38875ec1335daeec5b769e765bdd57d825272566b6a1d9dd69c8a199ded2f8ba27b3304fdfdbacf03855e2cbde4cd4186e298c7fdb02322b9658be79357e
|
|
7
|
+
data.tar.gz: 32ef6e8cfe422a0f3a625de8943d43b4e99a5d3b9645f8dfa7beac3d225c42833281925136647afc4b4e9e60971d2ac496f31a316c6f12a512aa633f7a807b70
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
CHANGED
|
Binary file
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,92 +1,87 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
country-select-engine (0.1.
|
|
5
|
-
rails (
|
|
4
|
+
country-select-engine (0.1.3)
|
|
5
|
+
rails (>= 4.0.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
|
-
remote:
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
actionmailer (
|
|
11
|
-
actionpack (=
|
|
12
|
-
mail (~> 2.
|
|
13
|
-
actionpack (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
builder (~> 3.0.0)
|
|
10
|
+
actionmailer (4.0.0)
|
|
11
|
+
actionpack (= 4.0.0)
|
|
12
|
+
mail (~> 2.5.3)
|
|
13
|
+
actionpack (4.0.0)
|
|
14
|
+
activesupport (= 4.0.0)
|
|
15
|
+
builder (~> 3.1.0)
|
|
17
16
|
erubis (~> 2.7.0)
|
|
18
|
-
|
|
19
|
-
rack (~>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
builder (3.0.0)
|
|
17
|
+
rack (~> 1.5.2)
|
|
18
|
+
rack-test (~> 0.6.2)
|
|
19
|
+
activemodel (4.0.0)
|
|
20
|
+
activesupport (= 4.0.0)
|
|
21
|
+
builder (~> 3.1.0)
|
|
22
|
+
activerecord (4.0.0)
|
|
23
|
+
activemodel (= 4.0.0)
|
|
24
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
|
25
|
+
activesupport (= 4.0.0)
|
|
26
|
+
arel (~> 4.0.0)
|
|
27
|
+
activerecord-deprecated_finders (1.0.3)
|
|
28
|
+
activesupport (4.0.0)
|
|
29
|
+
i18n (~> 0.6, >= 0.6.4)
|
|
30
|
+
minitest (~> 4.2)
|
|
31
|
+
multi_json (~> 1.3)
|
|
32
|
+
thread_safe (~> 0.1)
|
|
33
|
+
tzinfo (~> 0.3.37)
|
|
34
|
+
arel (4.0.0)
|
|
35
|
+
atomic (1.1.10)
|
|
36
|
+
builder (3.1.4)
|
|
39
37
|
erubis (2.7.0)
|
|
40
|
-
hike (1.2.
|
|
41
|
-
i18n (0.6.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
json (1.7.3)
|
|
47
|
-
mail (2.4.4)
|
|
48
|
-
i18n (>= 0.4.0)
|
|
38
|
+
hike (1.2.3)
|
|
39
|
+
i18n (0.6.4)
|
|
40
|
+
jquery-rails (3.0.4)
|
|
41
|
+
railties (>= 3.0, < 5.0)
|
|
42
|
+
thor (>= 0.14, < 2.0)
|
|
43
|
+
mail (2.5.4)
|
|
49
44
|
mime-types (~> 1.16)
|
|
50
45
|
treetop (~> 1.4.8)
|
|
51
|
-
mime-types (1.
|
|
52
|
-
|
|
46
|
+
mime-types (1.23)
|
|
47
|
+
minitest (4.7.5)
|
|
48
|
+
multi_json (1.7.7)
|
|
53
49
|
polyglot (0.3.3)
|
|
54
|
-
rack (1.
|
|
55
|
-
rack-
|
|
56
|
-
rack (>= 0.4)
|
|
57
|
-
rack-ssl (1.3.2)
|
|
58
|
-
rack
|
|
59
|
-
rack-test (0.6.1)
|
|
50
|
+
rack (1.5.2)
|
|
51
|
+
rack-test (0.6.2)
|
|
60
52
|
rack (>= 1.0)
|
|
61
|
-
rails (
|
|
62
|
-
actionmailer (=
|
|
63
|
-
actionpack (=
|
|
64
|
-
activerecord (=
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
railties (
|
|
70
|
-
actionpack (=
|
|
71
|
-
activesupport (=
|
|
72
|
-
rack-ssl (~> 1.3.2)
|
|
53
|
+
rails (4.0.0)
|
|
54
|
+
actionmailer (= 4.0.0)
|
|
55
|
+
actionpack (= 4.0.0)
|
|
56
|
+
activerecord (= 4.0.0)
|
|
57
|
+
activesupport (= 4.0.0)
|
|
58
|
+
bundler (>= 1.3.0, < 2.0)
|
|
59
|
+
railties (= 4.0.0)
|
|
60
|
+
sprockets-rails (~> 2.0.0)
|
|
61
|
+
railties (4.0.0)
|
|
62
|
+
actionpack (= 4.0.0)
|
|
63
|
+
activesupport (= 4.0.0)
|
|
73
64
|
rake (>= 0.8.7)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
rdoc (3.12)
|
|
78
|
-
json (~> 1.4)
|
|
79
|
-
sprockets (2.1.3)
|
|
65
|
+
thor (>= 0.18.1, < 2.0)
|
|
66
|
+
rake (10.1.0)
|
|
67
|
+
sprockets (2.10.0)
|
|
80
68
|
hike (~> 1.2)
|
|
69
|
+
multi_json (~> 1.0)
|
|
81
70
|
rack (~> 1.0)
|
|
82
71
|
tilt (~> 1.1, != 1.3.0)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
sprockets-rails (2.0.0)
|
|
73
|
+
actionpack (>= 3.0)
|
|
74
|
+
activesupport (>= 3.0)
|
|
75
|
+
sprockets (~> 2.8)
|
|
76
|
+
sqlite3 (1.3.7)
|
|
77
|
+
thor (0.18.1)
|
|
78
|
+
thread_safe (0.1.0)
|
|
79
|
+
atomic
|
|
80
|
+
tilt (1.4.1)
|
|
81
|
+
treetop (1.4.14)
|
|
87
82
|
polyglot
|
|
88
83
|
polyglot (>= 0.3.1)
|
|
89
|
-
tzinfo (0.3.
|
|
84
|
+
tzinfo (0.3.37)
|
|
90
85
|
|
|
91
86
|
PLATFORMS
|
|
92
87
|
ruby
|
data/Rakefile
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
#!/usr/bin/env rake
|
|
2
1
|
begin
|
|
3
2
|
require 'bundler/setup'
|
|
4
3
|
rescue LoadError
|
|
5
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
6
5
|
end
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
rescue LoadError
|
|
10
|
-
require 'rdoc/rdoc'
|
|
11
|
-
require 'rake/rdoctask'
|
|
12
|
-
RDoc::Task = Rake::RDocTask
|
|
13
|
-
end
|
|
6
|
+
|
|
7
|
+
require 'rdoc/task'
|
|
14
8
|
|
|
15
9
|
RDoc::Task.new(:rdoc) do |rdoc|
|
|
16
10
|
rdoc.rdoc_dir = 'rdoc'
|
|
@@ -20,10 +14,21 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
|
20
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
21
15
|
end
|
|
22
16
|
|
|
23
|
-
APP_RAKEFILE = File.expand_path("../
|
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
24
18
|
load 'rails/tasks/engine.rake'
|
|
25
19
|
|
|
26
20
|
|
|
27
21
|
|
|
28
22
|
Bundler::GemHelper.install_tasks
|
|
29
23
|
|
|
24
|
+
require 'rake/testtask'
|
|
25
|
+
|
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
|
27
|
+
t.libs << 'lib'
|
|
28
|
+
t.libs << 'test'
|
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
|
30
|
+
t.verbose = false
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
task default: :test
|
|
File without changes
|
data/{script → bin}/google.yml
RENAMED
|
File without changes
|
|
File without changes
|
data/{script → bin}/rails
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
# This command will automatically be run when you run "rails" with Rails
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
|
3
3
|
|
|
4
4
|
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
|
5
5
|
ENGINE_PATH = File.expand_path('../../lib/country-select-engine/engine', __FILE__)
|
|
File without changes
|
|
File without changes
|
|
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
|
|
|
12
12
|
s.homepage = "https://github.com/yjchen/country-select-engine"
|
|
13
13
|
s.summary = "Rails engine for localized_country_select."
|
|
14
14
|
s.description = "Provide a list of localized countries, currencies and time zones"
|
|
15
|
+
s.license = 'MIT'
|
|
15
16
|
|
|
16
17
|
s.files = `git ls-files`.split("\n")
|
|
17
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
@@ -20,9 +21,7 @@ Gem::Specification.new do |s|
|
|
|
20
21
|
s.signing_key = File.join(Dir.home,'/.gem/trust/gem-private_key.pem')
|
|
21
22
|
s.cert_chain = ['gem-public_cert.pem']
|
|
22
23
|
|
|
23
|
-
s.add_dependency "rails", "
|
|
24
|
-
# s.add_dependency "hpricot"
|
|
25
|
-
# s.add_dependency "jquery-rails"
|
|
24
|
+
s.add_dependency "rails", ">= 4.0.0"
|
|
26
25
|
|
|
27
26
|
s.add_development_dependency "sqlite3"
|
|
28
27
|
end
|
|
@@ -105,8 +105,14 @@ module ActionView
|
|
|
105
105
|
categories.each do |category|
|
|
106
106
|
class_eval %Q{
|
|
107
107
|
def localized_#{category.singularize}_select(object, method, priority_countries = nil, options = {}, html_options = {})
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
choices = CountrySelectEngine.localized_#{category}_array
|
|
109
|
+
if priority_countries
|
|
110
|
+
priority = CountrySelectEngine::priority_#{category}_array(priority_countries)
|
|
111
|
+
priority << ['--------', nil]
|
|
112
|
+
choices = priority + choices
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
Tags::Select.new(object, method, self, choices, options, html_options).render
|
|
110
116
|
end
|
|
111
117
|
}
|
|
112
118
|
end
|
|
@@ -146,31 +152,12 @@ module ActionView
|
|
|
146
152
|
|
|
147
153
|
end
|
|
148
154
|
|
|
149
|
-
class InstanceTag
|
|
150
|
-
categories = ['currencies', 'countries', 'languages', 'timezones']
|
|
151
|
-
categories.each do |category|
|
|
152
|
-
class_eval %Q{
|
|
153
|
-
def to_localized_#{category.singularize}_select_tag(priority_countries, options, html_options)
|
|
154
|
-
html_options = html_options.stringify_keys
|
|
155
|
-
add_default_name_and_id(html_options)
|
|
156
|
-
value = options.has_key?(:selected) ? options[:selected] : value(object)
|
|
157
|
-
content_tag("select",
|
|
158
|
-
add_options(
|
|
159
|
-
localized_#{category.singularize}_options_for_select(value, priority_countries, options).html_safe,
|
|
160
|
-
options, value
|
|
161
|
-
), html_options
|
|
162
|
-
)
|
|
163
|
-
end
|
|
164
|
-
}
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
|
|
168
155
|
class FormBuilder
|
|
169
156
|
categories = ['currencies', 'countries', 'languages', 'timezones']
|
|
170
157
|
categories.each do |category|
|
|
171
158
|
class_eval %Q{
|
|
172
159
|
def localized_#{category.singularize}_select(method, priority_countries = nil, options = {}, html_options = {})
|
|
173
|
-
@template.localized_#{category.singularize}_select(@object_name, method, priority_countries, options.merge(
|
|
160
|
+
@template.localized_#{category.singularize}_select(@object_name, method, priority_countries, objectify_options(options), @default_options.merge(html_options))
|
|
174
161
|
end
|
|
175
162
|
}
|
|
176
163
|
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
== README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
|
28
|
+
<tt>rake doc:app</tt>.
|
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
6
|
//
|
|
7
7
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
-
//
|
|
8
|
+
// compiled file.
|
|
9
9
|
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
12
|
//
|
|
13
|
-
//= require jquery
|
|
14
|
-
//= require jquery_ujs
|
|
15
13
|
//= require_tree .
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
<div>
|
|
1
2
|
<p><b>In English</b></p>
|
|
2
3
|
<p>
|
|
3
4
|
Translation of US is <%= t('US', :scope => 'countries') %>
|
|
@@ -8,6 +9,8 @@ Translation of US is <%= t('US', :scope => 'countries') %>
|
|
|
8
9
|
<%= localized_currency_select(:user, :country, [], :include_blank => 'Please choose...') %>
|
|
9
10
|
<%= localized_timezone_select(:user, :country, [], :include_blank => 'Please choose...') %>
|
|
10
11
|
</p>
|
|
12
|
+
</div>
|
|
13
|
+
<div>
|
|
11
14
|
<p><b>In Deutsch (Germany)</b></p>
|
|
12
15
|
<% I18n.locale = :de %>
|
|
13
16
|
<p>
|
|
@@ -18,6 +21,8 @@ Translation of US is <%= t('US', :scope => 'countries') %>
|
|
|
18
21
|
<%= localized_language_select(:user, :country, [], :include_blank => 'Please choose...') %>
|
|
19
22
|
<%= localized_currency_select(:user, :country, [], :include_blank => 'Please choose...') %>
|
|
20
23
|
</p>
|
|
24
|
+
</div>
|
|
25
|
+
<div>
|
|
21
26
|
<p><b>In Traditional Chinese</b></p>
|
|
22
27
|
<% I18n.locale = :'zh-TW' %>
|
|
23
28
|
<p>
|
|
@@ -29,3 +34,12 @@ Translation of US is <%= t('US', :scope => 'countries') %>
|
|
|
29
34
|
<%= localized_currency_select(:user, :country, [], {:include_blank => 'Please choose...', :symbol => :prepend}) %>
|
|
30
35
|
<%= localized_timezone_select(:user, :country, [], {:include_blank => 'Please choose...', :sort => false, :timezone => :prepend}) %>
|
|
31
36
|
</p>
|
|
37
|
+
</div>
|
|
38
|
+
<div>
|
|
39
|
+
<% I18n.locale = :en %>
|
|
40
|
+
<%= form_for @selected do |f| %>
|
|
41
|
+
<%= f.localized_country_select(:country, [:TW, :CN]) %>
|
|
42
|
+
<hr/>
|
|
43
|
+
<%= f.select(:country, localized_country_options_for_select(@selected.country).html_safe) %>
|
|
44
|
+
<% end %>
|
|
45
|
+
</div>
|
|
File without changes
|