country_select 4.0.0 → 8.0.1
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 +4 -4
- data/.github/workflows/build.yml +25 -0
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/CHANGELOG.md +50 -0
- data/Gemfile +0 -6
- data/Gemfile.lock +61 -272
- data/README.md +31 -17
- data/Rakefile +29 -3
- data/country_select.gemspec +9 -9
- data/gemfiles/{actionpack5.2.gemfile → actionpack-5.2.gemfile} +1 -6
- data/gemfiles/actionpack-5.2.gemfile.lock +99 -0
- data/gemfiles/actionpack-6.0.gemfile +7 -0
- data/gemfiles/actionpack-6.0.gemfile.lock +101 -0
- data/gemfiles/actionpack-6.1.gemfile +7 -0
- data/gemfiles/actionpack-6.1.gemfile.lock +100 -0
- data/gemfiles/actionpack-7.0.gemfile +7 -0
- data/gemfiles/actionpack-7.0.gemfile.lock +100 -0
- data/lib/country_select/country_select_helper.rb +5 -0
- data/lib/country_select/defaults.rb +11 -0
- data/lib/country_select/formats.rb +3 -1
- data/lib/country_select/tag_helper.rb +19 -25
- data/lib/country_select/version.rb +1 -1
- data/lib/country_select.rb +2 -7
- data/spec/country_select_spec.rb +112 -25
- metadata +33 -67
- data/.travis.yml +0 -41
- data/gemfiles/actionpack.edge.gemfile +0 -15
- data/gemfiles/actionpack.edge.gemfile.lock +0 -310
- data/gemfiles/actionpack3.2.gemfile +0 -11
- data/gemfiles/actionpack3.2.gemfile.lock +0 -297
- data/gemfiles/actionpack4.0.gemfile +0 -11
- data/gemfiles/actionpack4.0.gemfile.lock +0 -286
- data/gemfiles/actionpack4.1.gemfile +0 -11
- data/gemfiles/actionpack4.1.gemfile.lock +0 -290
- data/gemfiles/actionpack4.2.gemfile +0 -14
- data/gemfiles/actionpack4.2.gemfile.lock +0 -306
- data/gemfiles/actionpack5.0.gemfile +0 -12
- data/gemfiles/actionpack5.0.gemfile.lock +0 -311
- data/gemfiles/actionpack5.1.gemfile +0 -12
- data/gemfiles/actionpack5.1.gemfile.lock +0 -311
- data/gemfiles/actionpack5.2.gemfile.lock +0 -312
- data/lib/country_select/rails3/country_select_helper.rb +0 -39
- data/lib/country_select_without_sort_alphabetical.rb +0 -13
data/Rakefile
CHANGED
@@ -1,10 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/setup'
|
2
4
|
require 'rake'
|
3
5
|
require 'bundler/gem_tasks'
|
4
6
|
|
5
|
-
require 'wwtd/tasks'
|
6
|
-
|
7
7
|
require 'rspec/core/rake_task'
|
8
8
|
RSpec::Core::RakeTask.new(:spec)
|
9
9
|
|
10
|
-
task default:
|
10
|
+
task default: 'spec'
|
11
|
+
|
12
|
+
|
13
|
+
task :update_gemfiles do
|
14
|
+
require 'pry'
|
15
|
+
Dir.glob('gemfiles/*.gemfile').each do |gemfile|
|
16
|
+
puts "Updating #{gemfile}...\n\n"
|
17
|
+
ENV['BUNDLE_GEMFILE']=gemfile
|
18
|
+
puts `bundle install --gemfile=#{gemfile} --no-cache`
|
19
|
+
puts `bundle update --gemfile=#{gemfile}`
|
20
|
+
|
21
|
+
lockfile = "#{gemfile}.lock"
|
22
|
+
|
23
|
+
if File.exist? lockfile
|
24
|
+
parsed_lockfile = Bundler::LockfileParser.new(Bundler.read_file(lockfile))
|
25
|
+
# Ensure lockfile has x86_64-linux
|
26
|
+
if parsed_lockfile.platforms.map(&:to_s).none? {|p| p == 'x86_64-linux' }
|
27
|
+
puts "Adding platform x86_64-linux to #{lockfile}\n\n"
|
28
|
+
puts `bundle lock --add-platform x86_64-linux --gemfile=#{gemfile}`
|
29
|
+
end
|
30
|
+
|
31
|
+
puts ""
|
32
|
+
else
|
33
|
+
raise StandardError.new("Expected #{lockfile} to exist.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/country_select.gemspec
CHANGED
@@ -8,25 +8,25 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.licenses = ['MIT']
|
9
9
|
s.authors = ['Stefan Penner']
|
10
10
|
s.email = ['stefan.penner@gmail.com']
|
11
|
-
s.homepage = 'https://github.com/
|
11
|
+
s.homepage = 'https://github.com/countries/country_select'
|
12
12
|
s.summary = %q{Country Select Plugin}
|
13
|
-
s.description = %q{Provides a simple helper to get an HTML select list of countries.
|
13
|
+
s.description = %q{Provides a simple helper to get an HTML select list of countries. The list of countries comes from the ISO 3166 standard. While it is a relatively neutral source of country names, it will still offend some users.}
|
14
14
|
|
15
|
-
s.
|
15
|
+
s.metadata = { 'bug_tracker_uri' => 'http://github.com/countries/country_select/issues',
|
16
|
+
'changelog_uri' => 'https://github.com/countries/country_select/blob/master/CHANGELOG.md',
|
17
|
+
'source_code_uri' => 'https://github.com/countries/country_select' }
|
16
18
|
|
17
19
|
s.files = `git ls-files`.split("\n")
|
18
20
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
21
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
22
|
s.require_paths = ['lib']
|
21
23
|
|
22
|
-
s.required_ruby_version = '>= 2'
|
24
|
+
s.required_ruby_version = '>= 2.7'
|
23
25
|
|
24
|
-
s.add_development_dependency 'actionpack', '~>
|
26
|
+
s.add_development_dependency 'actionpack', '~> 7.0'
|
25
27
|
s.add_development_dependency 'pry', '~> 0'
|
26
|
-
s.add_development_dependency 'rake'
|
28
|
+
s.add_development_dependency 'rake', '~> 13'
|
27
29
|
s.add_development_dependency 'rspec', '~> 3'
|
28
|
-
s.add_development_dependency 'wwtd'
|
29
30
|
|
30
|
-
s.add_dependency 'countries', '~>
|
31
|
-
s.add_dependency 'sort_alphabetical', '~> 1.0'
|
31
|
+
s.add_dependency 'countries', '~> 5.0'
|
32
32
|
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
country_select (8.0.1)
|
5
|
+
countries (~> 5.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionpack (5.2.8.1)
|
11
|
+
actionview (= 5.2.8.1)
|
12
|
+
activesupport (= 5.2.8.1)
|
13
|
+
rack (~> 2.0, >= 2.0.8)
|
14
|
+
rack-test (>= 0.6.3)
|
15
|
+
rails-dom-testing (~> 2.0)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
17
|
+
actionview (5.2.8.1)
|
18
|
+
activesupport (= 5.2.8.1)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubi (~> 1.4)
|
21
|
+
rails-dom-testing (~> 2.0)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
23
|
+
activesupport (5.2.8.1)
|
24
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
|
+
i18n (>= 0.7, < 2)
|
26
|
+
minitest (~> 5.1)
|
27
|
+
tzinfo (~> 1.1)
|
28
|
+
builder (3.2.4)
|
29
|
+
coderay (1.1.3)
|
30
|
+
concurrent-ruby (1.1.10)
|
31
|
+
countries (5.3.0)
|
32
|
+
unaccent (~> 0.3)
|
33
|
+
crass (1.0.6)
|
34
|
+
diff-lcs (1.5.0)
|
35
|
+
erubi (1.12.0)
|
36
|
+
i18n (1.12.0)
|
37
|
+
concurrent-ruby (~> 1.0)
|
38
|
+
loofah (2.19.1)
|
39
|
+
crass (~> 1.0.2)
|
40
|
+
nokogiri (>= 1.5.9)
|
41
|
+
method_source (1.0.0)
|
42
|
+
minitest (5.17.0)
|
43
|
+
nokogiri (1.14.0.rc1-x86_64-darwin)
|
44
|
+
racc (~> 1.4)
|
45
|
+
nokogiri (1.14.0.rc1-x86_64-linux)
|
46
|
+
racc (~> 1.4)
|
47
|
+
pry (0.14.1)
|
48
|
+
coderay (~> 1.1)
|
49
|
+
method_source (~> 1.0)
|
50
|
+
racc (1.6.2)
|
51
|
+
rack (2.2.5)
|
52
|
+
rack-test (2.0.2)
|
53
|
+
rack (>= 1.3)
|
54
|
+
rails-dom-testing (2.0.3)
|
55
|
+
activesupport (>= 4.2.0)
|
56
|
+
nokogiri (>= 1.6)
|
57
|
+
rails-html-sanitizer (1.4.4)
|
58
|
+
loofah (~> 2.19, >= 2.19.1)
|
59
|
+
railties (5.2.8.1)
|
60
|
+
actionpack (= 5.2.8.1)
|
61
|
+
activesupport (= 5.2.8.1)
|
62
|
+
method_source
|
63
|
+
rake (>= 0.8.7)
|
64
|
+
thor (>= 0.19.0, < 2.0)
|
65
|
+
rake (13.0.6)
|
66
|
+
rspec (3.12.0)
|
67
|
+
rspec-core (~> 3.12.0)
|
68
|
+
rspec-expectations (~> 3.12.0)
|
69
|
+
rspec-mocks (~> 3.12.0)
|
70
|
+
rspec-core (3.12.0)
|
71
|
+
rspec-support (~> 3.12.0)
|
72
|
+
rspec-expectations (3.12.1)
|
73
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
+
rspec-support (~> 3.12.0)
|
75
|
+
rspec-mocks (3.12.1)
|
76
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
77
|
+
rspec-support (~> 3.12.0)
|
78
|
+
rspec-support (3.12.0)
|
79
|
+
thor (1.2.1)
|
80
|
+
thread_safe (0.3.6)
|
81
|
+
tzinfo (1.2.10)
|
82
|
+
thread_safe (~> 0.1)
|
83
|
+
unaccent (0.4.0)
|
84
|
+
|
85
|
+
PLATFORMS
|
86
|
+
x86_64-darwin-22
|
87
|
+
x86_64-linux
|
88
|
+
|
89
|
+
DEPENDENCIES
|
90
|
+
actionpack (~> 5.2.0)
|
91
|
+
country_select!
|
92
|
+
nokogiri (= 1.14.0.rc1)
|
93
|
+
pry (~> 0)
|
94
|
+
railties (~> 5.2.0)
|
95
|
+
rake (~> 13)
|
96
|
+
rspec (~> 3)
|
97
|
+
|
98
|
+
BUNDLED WITH
|
99
|
+
2.4.2
|
@@ -0,0 +1,101 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
country_select (8.0.1)
|
5
|
+
countries (~> 5.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionpack (6.0.6)
|
11
|
+
actionview (= 6.0.6)
|
12
|
+
activesupport (= 6.0.6)
|
13
|
+
rack (~> 2.0, >= 2.0.8)
|
14
|
+
rack-test (>= 0.6.3)
|
15
|
+
rails-dom-testing (~> 2.0)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
+
actionview (6.0.6)
|
18
|
+
activesupport (= 6.0.6)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubi (~> 1.4)
|
21
|
+
rails-dom-testing (~> 2.0)
|
22
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
+
activesupport (6.0.6)
|
24
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
|
+
i18n (>= 0.7, < 2)
|
26
|
+
minitest (~> 5.1)
|
27
|
+
tzinfo (~> 1.1)
|
28
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
29
|
+
builder (3.2.4)
|
30
|
+
coderay (1.1.3)
|
31
|
+
concurrent-ruby (1.1.10)
|
32
|
+
countries (5.3.0)
|
33
|
+
unaccent (~> 0.3)
|
34
|
+
crass (1.0.6)
|
35
|
+
diff-lcs (1.5.0)
|
36
|
+
erubi (1.12.0)
|
37
|
+
i18n (1.12.0)
|
38
|
+
concurrent-ruby (~> 1.0)
|
39
|
+
loofah (2.19.1)
|
40
|
+
crass (~> 1.0.2)
|
41
|
+
nokogiri (>= 1.5.9)
|
42
|
+
method_source (1.0.0)
|
43
|
+
minitest (5.17.0)
|
44
|
+
nokogiri (1.14.0.rc1-x86_64-darwin)
|
45
|
+
racc (~> 1.4)
|
46
|
+
nokogiri (1.14.0.rc1-x86_64-linux)
|
47
|
+
racc (~> 1.4)
|
48
|
+
pry (0.14.1)
|
49
|
+
coderay (~> 1.1)
|
50
|
+
method_source (~> 1.0)
|
51
|
+
racc (1.6.2)
|
52
|
+
rack (2.2.5)
|
53
|
+
rack-test (2.0.2)
|
54
|
+
rack (>= 1.3)
|
55
|
+
rails-dom-testing (2.0.3)
|
56
|
+
activesupport (>= 4.2.0)
|
57
|
+
nokogiri (>= 1.6)
|
58
|
+
rails-html-sanitizer (1.4.4)
|
59
|
+
loofah (~> 2.19, >= 2.19.1)
|
60
|
+
railties (6.0.6)
|
61
|
+
actionpack (= 6.0.6)
|
62
|
+
activesupport (= 6.0.6)
|
63
|
+
method_source
|
64
|
+
rake (>= 0.8.7)
|
65
|
+
thor (>= 0.20.3, < 2.0)
|
66
|
+
rake (13.0.6)
|
67
|
+
rspec (3.12.0)
|
68
|
+
rspec-core (~> 3.12.0)
|
69
|
+
rspec-expectations (~> 3.12.0)
|
70
|
+
rspec-mocks (~> 3.12.0)
|
71
|
+
rspec-core (3.12.0)
|
72
|
+
rspec-support (~> 3.12.0)
|
73
|
+
rspec-expectations (3.12.1)
|
74
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
+
rspec-support (~> 3.12.0)
|
76
|
+
rspec-mocks (3.12.1)
|
77
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
+
rspec-support (~> 3.12.0)
|
79
|
+
rspec-support (3.12.0)
|
80
|
+
thor (1.2.1)
|
81
|
+
thread_safe (0.3.6)
|
82
|
+
tzinfo (1.2.10)
|
83
|
+
thread_safe (~> 0.1)
|
84
|
+
unaccent (0.4.0)
|
85
|
+
zeitwerk (2.6.6)
|
86
|
+
|
87
|
+
PLATFORMS
|
88
|
+
x86_64-darwin-22
|
89
|
+
x86_64-linux
|
90
|
+
|
91
|
+
DEPENDENCIES
|
92
|
+
actionpack (~> 6.0.0)
|
93
|
+
country_select!
|
94
|
+
nokogiri (= 1.14.0.rc1)
|
95
|
+
pry (~> 0)
|
96
|
+
railties (~> 6.0.0)
|
97
|
+
rake (~> 13)
|
98
|
+
rspec (~> 3)
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
2.4.2
|
@@ -0,0 +1,100 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
country_select (8.0.1)
|
5
|
+
countries (~> 5.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionpack (6.1.7)
|
11
|
+
actionview (= 6.1.7)
|
12
|
+
activesupport (= 6.1.7)
|
13
|
+
rack (~> 2.0, >= 2.0.9)
|
14
|
+
rack-test (>= 0.6.3)
|
15
|
+
rails-dom-testing (~> 2.0)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
+
actionview (6.1.7)
|
18
|
+
activesupport (= 6.1.7)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubi (~> 1.4)
|
21
|
+
rails-dom-testing (~> 2.0)
|
22
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
+
activesupport (6.1.7)
|
24
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
|
+
i18n (>= 1.6, < 2)
|
26
|
+
minitest (>= 5.1)
|
27
|
+
tzinfo (~> 2.0)
|
28
|
+
zeitwerk (~> 2.3)
|
29
|
+
builder (3.2.4)
|
30
|
+
coderay (1.1.3)
|
31
|
+
concurrent-ruby (1.1.10)
|
32
|
+
countries (5.3.0)
|
33
|
+
unaccent (~> 0.3)
|
34
|
+
crass (1.0.6)
|
35
|
+
diff-lcs (1.5.0)
|
36
|
+
erubi (1.12.0)
|
37
|
+
i18n (1.12.0)
|
38
|
+
concurrent-ruby (~> 1.0)
|
39
|
+
loofah (2.19.1)
|
40
|
+
crass (~> 1.0.2)
|
41
|
+
nokogiri (>= 1.5.9)
|
42
|
+
method_source (1.0.0)
|
43
|
+
minitest (5.17.0)
|
44
|
+
nokogiri (1.14.0.rc1-x86_64-darwin)
|
45
|
+
racc (~> 1.4)
|
46
|
+
nokogiri (1.14.0.rc1-x86_64-linux)
|
47
|
+
racc (~> 1.4)
|
48
|
+
pry (0.14.1)
|
49
|
+
coderay (~> 1.1)
|
50
|
+
method_source (~> 1.0)
|
51
|
+
racc (1.6.2)
|
52
|
+
rack (2.2.5)
|
53
|
+
rack-test (2.0.2)
|
54
|
+
rack (>= 1.3)
|
55
|
+
rails-dom-testing (2.0.3)
|
56
|
+
activesupport (>= 4.2.0)
|
57
|
+
nokogiri (>= 1.6)
|
58
|
+
rails-html-sanitizer (1.4.4)
|
59
|
+
loofah (~> 2.19, >= 2.19.1)
|
60
|
+
railties (6.1.7)
|
61
|
+
actionpack (= 6.1.7)
|
62
|
+
activesupport (= 6.1.7)
|
63
|
+
method_source
|
64
|
+
rake (>= 12.2)
|
65
|
+
thor (~> 1.0)
|
66
|
+
rake (13.0.6)
|
67
|
+
rspec (3.12.0)
|
68
|
+
rspec-core (~> 3.12.0)
|
69
|
+
rspec-expectations (~> 3.12.0)
|
70
|
+
rspec-mocks (~> 3.12.0)
|
71
|
+
rspec-core (3.12.0)
|
72
|
+
rspec-support (~> 3.12.0)
|
73
|
+
rspec-expectations (3.12.1)
|
74
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
+
rspec-support (~> 3.12.0)
|
76
|
+
rspec-mocks (3.12.1)
|
77
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
+
rspec-support (~> 3.12.0)
|
79
|
+
rspec-support (3.12.0)
|
80
|
+
thor (1.2.1)
|
81
|
+
tzinfo (2.0.5)
|
82
|
+
concurrent-ruby (~> 1.0)
|
83
|
+
unaccent (0.4.0)
|
84
|
+
zeitwerk (2.6.6)
|
85
|
+
|
86
|
+
PLATFORMS
|
87
|
+
x86_64-darwin-22
|
88
|
+
x86_64-linux
|
89
|
+
|
90
|
+
DEPENDENCIES
|
91
|
+
actionpack (~> 6.1.0)
|
92
|
+
country_select!
|
93
|
+
nokogiri (= 1.14.0.rc1)
|
94
|
+
pry (~> 0)
|
95
|
+
railties (~> 6.1.0)
|
96
|
+
rake (~> 13)
|
97
|
+
rspec (~> 3)
|
98
|
+
|
99
|
+
BUNDLED WITH
|
100
|
+
2.4.2
|
@@ -0,0 +1,100 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
country_select (8.0.1)
|
5
|
+
countries (~> 5.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionpack (7.0.4)
|
11
|
+
actionview (= 7.0.4)
|
12
|
+
activesupport (= 7.0.4)
|
13
|
+
rack (~> 2.0, >= 2.2.0)
|
14
|
+
rack-test (>= 0.6.3)
|
15
|
+
rails-dom-testing (~> 2.0)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
+
actionview (7.0.4)
|
18
|
+
activesupport (= 7.0.4)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubi (~> 1.4)
|
21
|
+
rails-dom-testing (~> 2.0)
|
22
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
+
activesupport (7.0.4)
|
24
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
|
+
i18n (>= 1.6, < 2)
|
26
|
+
minitest (>= 5.1)
|
27
|
+
tzinfo (~> 2.0)
|
28
|
+
builder (3.2.4)
|
29
|
+
coderay (1.1.3)
|
30
|
+
concurrent-ruby (1.1.10)
|
31
|
+
countries (5.3.0)
|
32
|
+
unaccent (~> 0.3)
|
33
|
+
crass (1.0.6)
|
34
|
+
diff-lcs (1.5.0)
|
35
|
+
erubi (1.12.0)
|
36
|
+
i18n (1.12.0)
|
37
|
+
concurrent-ruby (~> 1.0)
|
38
|
+
loofah (2.19.1)
|
39
|
+
crass (~> 1.0.2)
|
40
|
+
nokogiri (>= 1.5.9)
|
41
|
+
method_source (1.0.0)
|
42
|
+
minitest (5.17.0)
|
43
|
+
nokogiri (1.14.0.rc1-x86_64-darwin)
|
44
|
+
racc (~> 1.4)
|
45
|
+
nokogiri (1.14.0.rc1-x86_64-linux)
|
46
|
+
racc (~> 1.4)
|
47
|
+
pry (0.14.1)
|
48
|
+
coderay (~> 1.1)
|
49
|
+
method_source (~> 1.0)
|
50
|
+
racc (1.6.2)
|
51
|
+
rack (2.2.5)
|
52
|
+
rack-test (2.0.2)
|
53
|
+
rack (>= 1.3)
|
54
|
+
rails-dom-testing (2.0.3)
|
55
|
+
activesupport (>= 4.2.0)
|
56
|
+
nokogiri (>= 1.6)
|
57
|
+
rails-html-sanitizer (1.4.4)
|
58
|
+
loofah (~> 2.19, >= 2.19.1)
|
59
|
+
railties (7.0.4)
|
60
|
+
actionpack (= 7.0.4)
|
61
|
+
activesupport (= 7.0.4)
|
62
|
+
method_source
|
63
|
+
rake (>= 12.2)
|
64
|
+
thor (~> 1.0)
|
65
|
+
zeitwerk (~> 2.5)
|
66
|
+
rake (13.0.6)
|
67
|
+
rspec (3.12.0)
|
68
|
+
rspec-core (~> 3.12.0)
|
69
|
+
rspec-expectations (~> 3.12.0)
|
70
|
+
rspec-mocks (~> 3.12.0)
|
71
|
+
rspec-core (3.12.0)
|
72
|
+
rspec-support (~> 3.12.0)
|
73
|
+
rspec-expectations (3.12.1)
|
74
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
+
rspec-support (~> 3.12.0)
|
76
|
+
rspec-mocks (3.12.1)
|
77
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
+
rspec-support (~> 3.12.0)
|
79
|
+
rspec-support (3.12.0)
|
80
|
+
thor (1.2.1)
|
81
|
+
tzinfo (2.0.5)
|
82
|
+
concurrent-ruby (~> 1.0)
|
83
|
+
unaccent (0.4.0)
|
84
|
+
zeitwerk (2.6.6)
|
85
|
+
|
86
|
+
PLATFORMS
|
87
|
+
x86_64-darwin-22
|
88
|
+
x86_64-linux
|
89
|
+
|
90
|
+
DEPENDENCIES
|
91
|
+
actionpack (~> 7.0.0)
|
92
|
+
country_select!
|
93
|
+
nokogiri (= 1.14.0.rc1)
|
94
|
+
pry (~> 0)
|
95
|
+
railties (~> 7.0.0)
|
96
|
+
rake (~> 13)
|
97
|
+
rspec (~> 3)
|
98
|
+
|
99
|
+
BUNDLED WITH
|
100
|
+
2.4.2
|
@@ -6,6 +6,11 @@ module ActionView
|
|
6
6
|
html_options = options
|
7
7
|
options = priority_or_options
|
8
8
|
else
|
9
|
+
if RUBY_VERSION =~ /^3\.\d\.\d/
|
10
|
+
warn "DEPRECATION WARNING: Setting priority countries with the 1.x syntax is deprecated. Please use the `priority_countries:` option.", uplevel: 1, category: :deprecated
|
11
|
+
else
|
12
|
+
warn "DEPRECATION WARNING: Setting priority countries with the 1.x syntax is deprecated. Please use the `priority_countries:` option.", uplevel: 1
|
13
|
+
end
|
9
14
|
options[:priority_countries] = priority_or_options
|
10
15
|
end
|
11
16
|
|
@@ -2,6 +2,8 @@ module CountrySelect
|
|
2
2
|
FORMATS = {}
|
3
3
|
|
4
4
|
FORMATS[:default] = lambda do |country|
|
5
|
-
|
5
|
+
# Need to use :[] specifically, not :dig, because country.translations is a
|
6
|
+
# ISO3166::Translations object, which overrides :[] to support i18n locale fallbacks
|
7
|
+
country.translations&.send(:[], I18n.locale.to_s) || country.common_name || country.iso_short_name
|
6
8
|
end
|
7
9
|
end
|
@@ -3,7 +3,7 @@ module CountrySelect
|
|
3
3
|
module TagHelper
|
4
4
|
def country_option_tags
|
5
5
|
# In Rails 5.2+, `value` accepts no arguments and must also be called
|
6
|
-
#
|
6
|
+
# with parens to avoid the local variable of the same name
|
7
7
|
# https://github.com/rails/rails/pull/29791
|
8
8
|
selected_option = @options.fetch(:selected) do
|
9
9
|
if self.method(:value).arity == 0
|
@@ -19,7 +19,7 @@ module CountrySelect
|
|
19
19
|
}
|
20
20
|
|
21
21
|
if priority_countries.present?
|
22
|
-
priority_countries_options = country_options_for(priority_countries,
|
22
|
+
priority_countries_options = country_options_for(priority_countries, @options.fetch(:sort_provided, ::CountrySelect::DEFAULTS[:sort_provided]))
|
23
23
|
|
24
24
|
option_tags = options_for_select(priority_countries_options, option_tags_options)
|
25
25
|
option_tags += html_safe_newline + options_for_select([priority_countries_divider], disabled: priority_countries_divider)
|
@@ -35,43 +35,42 @@ module CountrySelect
|
|
35
35
|
|
36
36
|
private
|
37
37
|
def locale
|
38
|
-
@options[:locale]
|
38
|
+
@options.fetch(:locale, ::CountrySelect::DEFAULTS[:locale])
|
39
39
|
end
|
40
40
|
|
41
41
|
def priority_countries
|
42
|
-
@options[:priority_countries]
|
42
|
+
@options.fetch(:priority_countries, ::CountrySelect::DEFAULTS[:priority_countries])
|
43
43
|
end
|
44
44
|
|
45
45
|
def priority_countries_divider
|
46
|
-
@options[:priority_countries_divider]
|
46
|
+
@options.fetch(:priority_countries_divider, ::CountrySelect::DEFAULTS[:priority_countries_divider])
|
47
47
|
end
|
48
48
|
|
49
49
|
def only_country_codes
|
50
|
-
@options[:only]
|
50
|
+
@options.fetch(:only, ::CountrySelect::DEFAULTS[:only])
|
51
51
|
end
|
52
52
|
|
53
53
|
def except_country_codes
|
54
|
-
@options[:except]
|
54
|
+
@options.fetch(:except, ::CountrySelect::DEFAULTS[:except])
|
55
55
|
end
|
56
56
|
|
57
57
|
def format
|
58
|
-
@options[:format]
|
58
|
+
@options.fetch(:format, ::CountrySelect::DEFAULTS[:format])
|
59
59
|
end
|
60
60
|
|
61
61
|
def country_options
|
62
|
-
country_options_for(all_country_codes, true)
|
63
|
-
end
|
64
|
-
|
65
|
-
def all_country_codes
|
66
|
-
codes = ISO3166::Country.codes
|
67
|
-
|
68
62
|
if only_country_codes.present?
|
69
|
-
codes &
|
63
|
+
codes = only_country_codes & ISO3166::Country.codes
|
64
|
+
sort = @options.fetch(:sort_provided, ::CountrySelect::DEFAULTS[:sort_provided])
|
70
65
|
elsif except_country_codes.present?
|
71
|
-
codes - except_country_codes
|
66
|
+
codes = ISO3166::Country.codes - except_country_codes
|
67
|
+
sort = true
|
72
68
|
else
|
73
|
-
codes
|
69
|
+
codes = ISO3166::Country.codes
|
70
|
+
sort = true
|
74
71
|
end
|
72
|
+
|
73
|
+
country_options_for(codes, sort)
|
75
74
|
end
|
76
75
|
|
77
76
|
def country_options_for(country_codes, sorted=true)
|
@@ -79,9 +78,8 @@ module CountrySelect
|
|
79
78
|
country_list = country_codes.map do |code_or_name|
|
80
79
|
if country = ISO3166::Country.new(code_or_name)
|
81
80
|
code = country.alpha2
|
82
|
-
elsif country = ISO3166::Country.
|
83
|
-
code = country.
|
84
|
-
country = ISO3166::Country.new(code)
|
81
|
+
elsif country = ISO3166::Country.find_country_by_any_name(code_or_name)
|
82
|
+
code = country.alpha2
|
85
83
|
end
|
86
84
|
|
87
85
|
unless country.present?
|
@@ -100,11 +98,7 @@ module CountrySelect
|
|
100
98
|
end
|
101
99
|
|
102
100
|
if sorted
|
103
|
-
|
104
|
-
country_list.sort_alphabetical
|
105
|
-
else
|
106
|
-
country_list.sort
|
107
|
-
end
|
101
|
+
country_list.sort_by { |name, code| [I18n.transliterate(name), name] }
|
108
102
|
else
|
109
103
|
country_list
|
110
104
|
end
|
data/lib/country_select.rb
CHANGED
@@ -1,14 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require 'countries'
|
4
|
-
require 'sort_alphabetical'
|
5
4
|
|
6
5
|
require 'country_select/version'
|
6
|
+
require 'country_select/defaults'
|
7
7
|
require 'country_select/formats'
|
8
8
|
require 'country_select/tag_helper'
|
9
|
-
|
10
|
-
if defined?(ActionView::Helpers::Tags::Base)
|
11
|
-
require 'country_select/country_select_helper'
|
12
|
-
else
|
13
|
-
require 'country_select/rails3/country_select_helper'
|
14
|
-
end
|
9
|
+
require 'country_select/country_select_helper'
|