country_select 6.1.0 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +1 -6
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +31 -44
- data/README.md +12 -5
- data/Rakefile +26 -0
- data/country_select.gemspec +7 -4
- data/gemfiles/actionpack-5.2.gemfile +2 -2
- data/gemfiles/actionpack-5.2.gemfile.lock +37 -50
- data/gemfiles/actionpack-6.0.gemfile +2 -2
- data/gemfiles/actionpack-6.0.gemfile.lock +48 -60
- data/gemfiles/actionpack-6.1.gemfile +2 -2
- data/gemfiles/actionpack-6.1.gemfile.lock +39 -52
- data/gemfiles/actionpack-7.0.gemfile +2 -2
- data/gemfiles/actionpack-7.0.gemfile.lock +38 -51
- data/lib/country_select/country_select_helper.rb +5 -0
- data/lib/country_select/defaults.rb +2 -1
- data/lib/country_select/formats.rb +1 -1
- data/lib/country_select/tag_helper.rb +6 -11
- data/lib/country_select/version.rb +1 -1
- data/lib/country_select.rb +0 -1
- data/spec/country_select_spec.rb +47 -18
- metadata +12 -25
- data/gemfiles/actionpack-head.gemfile +0 -9
- data/gemfiles/actionpack-head.gemfile.lock +0 -109
- data/lib/country_select_without_sort_alphabetical.rb +0 -9
@@ -1,112 +1,100 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
country_select (
|
5
|
-
countries (~>
|
6
|
-
sort_alphabetical (~> 1.1)
|
4
|
+
country_select (7.0.0)
|
5
|
+
countries (~> 5.0)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
10
9
|
specs:
|
11
|
-
actionpack (6.
|
12
|
-
actionview (= 6.
|
13
|
-
activesupport (= 6.
|
14
|
-
rack (~> 2.0, >= 2.0.
|
10
|
+
actionpack (6.0.5)
|
11
|
+
actionview (= 6.0.5)
|
12
|
+
activesupport (= 6.0.5)
|
13
|
+
rack (~> 2.0, >= 2.0.8)
|
15
14
|
rack-test (>= 0.6.3)
|
16
15
|
rails-dom-testing (~> 2.0)
|
17
16
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
-
actionview (6.
|
19
|
-
activesupport (= 6.
|
17
|
+
actionview (6.0.5)
|
18
|
+
activesupport (= 6.0.5)
|
20
19
|
builder (~> 3.1)
|
21
20
|
erubi (~> 1.4)
|
22
21
|
rails-dom-testing (~> 2.0)
|
23
22
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
activesupport (6.
|
23
|
+
activesupport (6.0.5)
|
25
24
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
|
-
i18n (>=
|
27
|
-
minitest (
|
28
|
-
tzinfo (~>
|
29
|
-
zeitwerk (~> 2.
|
25
|
+
i18n (>= 0.7, < 2)
|
26
|
+
minitest (~> 5.1)
|
27
|
+
tzinfo (~> 1.1)
|
28
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
30
29
|
builder (3.2.4)
|
31
30
|
coderay (1.1.3)
|
32
|
-
concurrent-ruby (1.1.
|
33
|
-
countries (
|
34
|
-
i18n_data (~> 0.15.0)
|
31
|
+
concurrent-ruby (1.1.10)
|
32
|
+
countries (5.1.0)
|
35
33
|
sixarm_ruby_unaccent (~> 1.1)
|
36
34
|
crass (1.0.6)
|
37
35
|
diff-lcs (1.5.0)
|
38
36
|
erubi (1.10.0)
|
39
|
-
i18n (1.
|
37
|
+
i18n (1.10.0)
|
40
38
|
concurrent-ruby (~> 1.0)
|
41
|
-
|
42
|
-
simple_po_parser (~> 1.1)
|
43
|
-
loofah (2.13.0)
|
39
|
+
loofah (2.18.0)
|
44
40
|
crass (~> 1.0.2)
|
45
41
|
nokogiri (>= 1.5.9)
|
46
42
|
method_source (1.0.0)
|
47
|
-
|
48
|
-
|
49
|
-
nokogiri (1.13.1)
|
50
|
-
mini_portile2 (~> 2.7.0)
|
43
|
+
minitest (5.16.1)
|
44
|
+
nokogiri (1.13.6-x86_64-darwin)
|
51
45
|
racc (~> 1.4)
|
52
|
-
nokogiri (1.13.
|
53
|
-
racc (~> 1.4)
|
54
|
-
nokogiri (1.13.1-x86_64-linux)
|
46
|
+
nokogiri (1.13.6-x86_64-linux)
|
55
47
|
racc (~> 1.4)
|
56
48
|
pry (0.14.1)
|
57
49
|
coderay (~> 1.1)
|
58
50
|
method_source (~> 1.0)
|
59
51
|
racc (1.6.0)
|
60
|
-
rack (2.2.3)
|
61
|
-
rack-test (
|
62
|
-
rack (>= 1.
|
52
|
+
rack (2.2.3.1)
|
53
|
+
rack-test (2.0.2)
|
54
|
+
rack (>= 1.3)
|
63
55
|
rails-dom-testing (2.0.3)
|
64
56
|
activesupport (>= 4.2.0)
|
65
57
|
nokogiri (>= 1.6)
|
66
|
-
rails-html-sanitizer (1.4.
|
58
|
+
rails-html-sanitizer (1.4.3)
|
67
59
|
loofah (~> 2.3)
|
68
|
-
railties (6.
|
69
|
-
actionpack (= 6.
|
70
|
-
activesupport (= 6.
|
60
|
+
railties (6.0.5)
|
61
|
+
actionpack (= 6.0.5)
|
62
|
+
activesupport (= 6.0.5)
|
71
63
|
method_source
|
72
|
-
rake (>= 0.
|
73
|
-
thor (
|
64
|
+
rake (>= 0.8.7)
|
65
|
+
thor (>= 0.20.3, < 2.0)
|
74
66
|
rake (13.0.6)
|
75
|
-
rspec (3.
|
76
|
-
rspec-core (~> 3.
|
77
|
-
rspec-expectations (~> 3.
|
78
|
-
rspec-mocks (~> 3.
|
79
|
-
rspec-core (3.
|
80
|
-
rspec-support (~> 3.
|
81
|
-
rspec-expectations (3.
|
67
|
+
rspec (3.11.0)
|
68
|
+
rspec-core (~> 3.11.0)
|
69
|
+
rspec-expectations (~> 3.11.0)
|
70
|
+
rspec-mocks (~> 3.11.0)
|
71
|
+
rspec-core (3.11.0)
|
72
|
+
rspec-support (~> 3.11.0)
|
73
|
+
rspec-expectations (3.11.0)
|
82
74
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-mocks (3.
|
75
|
+
rspec-support (~> 3.11.0)
|
76
|
+
rspec-mocks (3.11.1)
|
85
77
|
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
-
rspec-support (~> 3.
|
87
|
-
rspec-support (3.
|
88
|
-
simple_po_parser (1.1.5)
|
78
|
+
rspec-support (~> 3.11.0)
|
79
|
+
rspec-support (3.11.0)
|
89
80
|
sixarm_ruby_unaccent (1.2.0)
|
90
|
-
sort_alphabetical (1.1.0)
|
91
|
-
unicode_utils (>= 1.2.2)
|
92
81
|
thor (1.2.1)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
zeitwerk (2.
|
82
|
+
thread_safe (0.3.6)
|
83
|
+
tzinfo (1.2.9)
|
84
|
+
thread_safe (~> 0.1)
|
85
|
+
zeitwerk (2.6.0)
|
97
86
|
|
98
87
|
PLATFORMS
|
99
|
-
|
100
|
-
ruby
|
88
|
+
x86_64-darwin-21
|
101
89
|
x86_64-linux
|
102
90
|
|
103
91
|
DEPENDENCIES
|
104
|
-
actionpack (~> 6.0)
|
92
|
+
actionpack (~> 6.0.0)
|
105
93
|
country_select!
|
106
94
|
pry (~> 0)
|
107
|
-
railties (~> 6.0)
|
95
|
+
railties (~> 6.0.0)
|
108
96
|
rake (~> 13)
|
109
97
|
rspec (~> 3)
|
110
98
|
|
111
99
|
BUNDLED WITH
|
112
|
-
2.3.
|
100
|
+
2.3.10
|
@@ -1,27 +1,26 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
country_select (
|
5
|
-
countries (~>
|
6
|
-
sort_alphabetical (~> 1.1)
|
4
|
+
country_select (7.0.0)
|
5
|
+
countries (~> 5.0)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
10
9
|
specs:
|
11
|
-
actionpack (6.1.
|
12
|
-
actionview (= 6.1.
|
13
|
-
activesupport (= 6.1.
|
10
|
+
actionpack (6.1.6)
|
11
|
+
actionview (= 6.1.6)
|
12
|
+
activesupport (= 6.1.6)
|
14
13
|
rack (~> 2.0, >= 2.0.9)
|
15
14
|
rack-test (>= 0.6.3)
|
16
15
|
rails-dom-testing (~> 2.0)
|
17
16
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
-
actionview (6.1.
|
19
|
-
activesupport (= 6.1.
|
17
|
+
actionview (6.1.6)
|
18
|
+
activesupport (= 6.1.6)
|
20
19
|
builder (~> 3.1)
|
21
20
|
erubi (~> 1.4)
|
22
21
|
rails-dom-testing (~> 2.0)
|
23
22
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
activesupport (6.1.
|
23
|
+
activesupport (6.1.6)
|
25
24
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
25
|
i18n (>= 1.6, < 2)
|
27
26
|
minitest (>= 5.1)
|
@@ -29,84 +28,72 @@ GEM
|
|
29
28
|
zeitwerk (~> 2.3)
|
30
29
|
builder (3.2.4)
|
31
30
|
coderay (1.1.3)
|
32
|
-
concurrent-ruby (1.1.
|
33
|
-
countries (
|
34
|
-
i18n_data (~> 0.15.0)
|
31
|
+
concurrent-ruby (1.1.10)
|
32
|
+
countries (5.1.0)
|
35
33
|
sixarm_ruby_unaccent (~> 1.1)
|
36
34
|
crass (1.0.6)
|
37
35
|
diff-lcs (1.5.0)
|
38
36
|
erubi (1.10.0)
|
39
|
-
i18n (1.
|
37
|
+
i18n (1.10.0)
|
40
38
|
concurrent-ruby (~> 1.0)
|
41
|
-
|
42
|
-
simple_po_parser (~> 1.1)
|
43
|
-
loofah (2.13.0)
|
39
|
+
loofah (2.18.0)
|
44
40
|
crass (~> 1.0.2)
|
45
41
|
nokogiri (>= 1.5.9)
|
46
42
|
method_source (1.0.0)
|
47
|
-
|
48
|
-
|
49
|
-
nokogiri (1.13.1)
|
50
|
-
mini_portile2 (~> 2.7.0)
|
43
|
+
minitest (5.16.1)
|
44
|
+
nokogiri (1.13.6-x86_64-darwin)
|
51
45
|
racc (~> 1.4)
|
52
|
-
nokogiri (1.13.
|
53
|
-
racc (~> 1.4)
|
54
|
-
nokogiri (1.13.1-x86_64-linux)
|
46
|
+
nokogiri (1.13.6-x86_64-linux)
|
55
47
|
racc (~> 1.4)
|
56
48
|
pry (0.14.1)
|
57
49
|
coderay (~> 1.1)
|
58
50
|
method_source (~> 1.0)
|
59
51
|
racc (1.6.0)
|
60
|
-
rack (2.2.3)
|
61
|
-
rack-test (
|
62
|
-
rack (>= 1.
|
52
|
+
rack (2.2.3.1)
|
53
|
+
rack-test (2.0.2)
|
54
|
+
rack (>= 1.3)
|
63
55
|
rails-dom-testing (2.0.3)
|
64
56
|
activesupport (>= 4.2.0)
|
65
57
|
nokogiri (>= 1.6)
|
66
|
-
rails-html-sanitizer (1.4.
|
58
|
+
rails-html-sanitizer (1.4.3)
|
67
59
|
loofah (~> 2.3)
|
68
|
-
railties (6.1.
|
69
|
-
actionpack (= 6.1.
|
70
|
-
activesupport (= 6.1.
|
60
|
+
railties (6.1.6)
|
61
|
+
actionpack (= 6.1.6)
|
62
|
+
activesupport (= 6.1.6)
|
71
63
|
method_source
|
72
|
-
rake (>=
|
64
|
+
rake (>= 12.2)
|
73
65
|
thor (~> 1.0)
|
74
66
|
rake (13.0.6)
|
75
|
-
rspec (3.
|
76
|
-
rspec-core (~> 3.
|
77
|
-
rspec-expectations (~> 3.
|
78
|
-
rspec-mocks (~> 3.
|
79
|
-
rspec-core (3.
|
80
|
-
rspec-support (~> 3.
|
81
|
-
rspec-expectations (3.
|
67
|
+
rspec (3.11.0)
|
68
|
+
rspec-core (~> 3.11.0)
|
69
|
+
rspec-expectations (~> 3.11.0)
|
70
|
+
rspec-mocks (~> 3.11.0)
|
71
|
+
rspec-core (3.11.0)
|
72
|
+
rspec-support (~> 3.11.0)
|
73
|
+
rspec-expectations (3.11.0)
|
82
74
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-mocks (3.
|
75
|
+
rspec-support (~> 3.11.0)
|
76
|
+
rspec-mocks (3.11.1)
|
85
77
|
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
-
rspec-support (~> 3.
|
87
|
-
rspec-support (3.
|
88
|
-
simple_po_parser (1.1.5)
|
78
|
+
rspec-support (~> 3.11.0)
|
79
|
+
rspec-support (3.11.0)
|
89
80
|
sixarm_ruby_unaccent (1.2.0)
|
90
|
-
sort_alphabetical (1.1.0)
|
91
|
-
unicode_utils (>= 1.2.2)
|
92
81
|
thor (1.2.1)
|
93
82
|
tzinfo (2.0.4)
|
94
83
|
concurrent-ruby (~> 1.0)
|
95
|
-
|
96
|
-
zeitwerk (2.5.3)
|
84
|
+
zeitwerk (2.6.0)
|
97
85
|
|
98
86
|
PLATFORMS
|
99
|
-
|
100
|
-
ruby
|
87
|
+
x86_64-darwin-21
|
101
88
|
x86_64-linux
|
102
89
|
|
103
90
|
DEPENDENCIES
|
104
|
-
actionpack (~> 6.1)
|
91
|
+
actionpack (~> 6.1.0)
|
105
92
|
country_select!
|
106
93
|
pry (~> 0)
|
107
|
-
railties (~> 6.1)
|
94
|
+
railties (~> 6.1.0)
|
108
95
|
rake (~> 13)
|
109
96
|
rspec (~> 3)
|
110
97
|
|
111
98
|
BUNDLED WITH
|
112
|
-
2.3.
|
99
|
+
2.3.10
|
@@ -1,112 +1,99 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
country_select (
|
5
|
-
countries (~>
|
6
|
-
sort_alphabetical (~> 1.1)
|
4
|
+
country_select (7.0.0)
|
5
|
+
countries (~> 5.0)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
10
9
|
specs:
|
11
|
-
actionpack (7.0.
|
12
|
-
actionview (= 7.0.
|
13
|
-
activesupport (= 7.0.
|
10
|
+
actionpack (7.0.3)
|
11
|
+
actionview (= 7.0.3)
|
12
|
+
activesupport (= 7.0.3)
|
14
13
|
rack (~> 2.0, >= 2.2.0)
|
15
14
|
rack-test (>= 0.6.3)
|
16
15
|
rails-dom-testing (~> 2.0)
|
17
16
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
-
actionview (7.0.
|
19
|
-
activesupport (= 7.0.
|
17
|
+
actionview (7.0.3)
|
18
|
+
activesupport (= 7.0.3)
|
20
19
|
builder (~> 3.1)
|
21
20
|
erubi (~> 1.4)
|
22
21
|
rails-dom-testing (~> 2.0)
|
23
22
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
activesupport (7.0.
|
23
|
+
activesupport (7.0.3)
|
25
24
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
25
|
i18n (>= 1.6, < 2)
|
27
26
|
minitest (>= 5.1)
|
28
27
|
tzinfo (~> 2.0)
|
29
28
|
builder (3.2.4)
|
30
29
|
coderay (1.1.3)
|
31
|
-
concurrent-ruby (1.1.
|
32
|
-
countries (
|
33
|
-
i18n_data (~> 0.15.0)
|
30
|
+
concurrent-ruby (1.1.10)
|
31
|
+
countries (5.1.0)
|
34
32
|
sixarm_ruby_unaccent (~> 1.1)
|
35
33
|
crass (1.0.6)
|
36
34
|
diff-lcs (1.5.0)
|
37
35
|
erubi (1.10.0)
|
38
|
-
i18n (1.
|
36
|
+
i18n (1.10.0)
|
39
37
|
concurrent-ruby (~> 1.0)
|
40
|
-
|
41
|
-
simple_po_parser (~> 1.1)
|
42
|
-
loofah (2.13.0)
|
38
|
+
loofah (2.18.0)
|
43
39
|
crass (~> 1.0.2)
|
44
40
|
nokogiri (>= 1.5.9)
|
45
41
|
method_source (1.0.0)
|
46
|
-
|
47
|
-
|
48
|
-
nokogiri (1.13.1)
|
49
|
-
mini_portile2 (~> 2.7.0)
|
42
|
+
minitest (5.16.1)
|
43
|
+
nokogiri (1.13.6-x86_64-darwin)
|
50
44
|
racc (~> 1.4)
|
51
|
-
nokogiri (1.13.
|
52
|
-
racc (~> 1.4)
|
53
|
-
nokogiri (1.13.1-x86_64-linux)
|
45
|
+
nokogiri (1.13.6-x86_64-linux)
|
54
46
|
racc (~> 1.4)
|
55
47
|
pry (0.14.1)
|
56
48
|
coderay (~> 1.1)
|
57
49
|
method_source (~> 1.0)
|
58
50
|
racc (1.6.0)
|
59
|
-
rack (2.2.3)
|
60
|
-
rack-test (
|
61
|
-
rack (>= 1.
|
51
|
+
rack (2.2.3.1)
|
52
|
+
rack-test (2.0.2)
|
53
|
+
rack (>= 1.3)
|
62
54
|
rails-dom-testing (2.0.3)
|
63
55
|
activesupport (>= 4.2.0)
|
64
56
|
nokogiri (>= 1.6)
|
65
|
-
rails-html-sanitizer (1.4.
|
57
|
+
rails-html-sanitizer (1.4.3)
|
66
58
|
loofah (~> 2.3)
|
67
|
-
railties (7.0.
|
68
|
-
actionpack (= 7.0.
|
69
|
-
activesupport (= 7.0.
|
59
|
+
railties (7.0.3)
|
60
|
+
actionpack (= 7.0.3)
|
61
|
+
activesupport (= 7.0.3)
|
70
62
|
method_source
|
71
63
|
rake (>= 12.2)
|
72
64
|
thor (~> 1.0)
|
73
65
|
zeitwerk (~> 2.5)
|
74
66
|
rake (13.0.6)
|
75
|
-
rspec (3.
|
76
|
-
rspec-core (~> 3.
|
77
|
-
rspec-expectations (~> 3.
|
78
|
-
rspec-mocks (~> 3.
|
79
|
-
rspec-core (3.
|
80
|
-
rspec-support (~> 3.
|
81
|
-
rspec-expectations (3.
|
67
|
+
rspec (3.11.0)
|
68
|
+
rspec-core (~> 3.11.0)
|
69
|
+
rspec-expectations (~> 3.11.0)
|
70
|
+
rspec-mocks (~> 3.11.0)
|
71
|
+
rspec-core (3.11.0)
|
72
|
+
rspec-support (~> 3.11.0)
|
73
|
+
rspec-expectations (3.11.0)
|
82
74
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-mocks (3.
|
75
|
+
rspec-support (~> 3.11.0)
|
76
|
+
rspec-mocks (3.11.1)
|
85
77
|
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
-
rspec-support (~> 3.
|
87
|
-
rspec-support (3.
|
88
|
-
simple_po_parser (1.1.5)
|
78
|
+
rspec-support (~> 3.11.0)
|
79
|
+
rspec-support (3.11.0)
|
89
80
|
sixarm_ruby_unaccent (1.2.0)
|
90
|
-
sort_alphabetical (1.1.0)
|
91
|
-
unicode_utils (>= 1.2.2)
|
92
81
|
thor (1.2.1)
|
93
82
|
tzinfo (2.0.4)
|
94
83
|
concurrent-ruby (~> 1.0)
|
95
|
-
|
96
|
-
zeitwerk (2.5.3)
|
84
|
+
zeitwerk (2.6.0)
|
97
85
|
|
98
86
|
PLATFORMS
|
99
|
-
|
100
|
-
ruby
|
87
|
+
x86_64-darwin-21
|
101
88
|
x86_64-linux
|
102
89
|
|
103
90
|
DEPENDENCIES
|
104
|
-
actionpack (~> 7.0)
|
91
|
+
actionpack (~> 7.0.0)
|
105
92
|
country_select!
|
106
93
|
pry (~> 0)
|
107
|
-
railties (~> 7.0)
|
94
|
+
railties (~> 7.0.0)
|
108
95
|
rake (~> 13)
|
109
96
|
rspec (~> 3)
|
110
97
|
|
111
98
|
BUNDLED WITH
|
112
|
-
2.3.
|
99
|
+
2.3.10
|
@@ -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
|
|
@@ -4,6 +4,6 @@ module CountrySelect
|
|
4
4
|
FORMATS[:default] = lambda do |country|
|
5
5
|
# Need to use :[] specifically, not :dig, because country.translations is a
|
6
6
|
# ISO3166::Translations object, which overrides :[] to support i18n locale fallbacks
|
7
|
-
country.translations&.send(:[], I18n.locale.to_s) || country.iso_short_name
|
7
|
+
country.translations&.send(:[], I18n.locale.to_s) || country.common_name || country.iso_short_name
|
8
8
|
end
|
9
9
|
end
|
@@ -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)
|
@@ -59,14 +59,14 @@ module CountrySelect
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def country_options
|
62
|
-
country_options_for(all_country_codes,
|
62
|
+
country_options_for(all_country_codes, @options.fetch(:sort_provided, ::CountrySelect::DEFAULTS[:sort_provided]))
|
63
63
|
end
|
64
64
|
|
65
65
|
def all_country_codes
|
66
66
|
codes = ISO3166::Country.codes
|
67
67
|
|
68
68
|
if only_country_codes.present?
|
69
|
-
|
69
|
+
only_country_codes & codes
|
70
70
|
elsif except_country_codes.present?
|
71
71
|
codes - except_country_codes
|
72
72
|
else
|
@@ -79,9 +79,8 @@ module CountrySelect
|
|
79
79
|
country_list = country_codes.map do |code_or_name|
|
80
80
|
if country = ISO3166::Country.new(code_or_name)
|
81
81
|
code = country.alpha2
|
82
|
-
elsif country = ISO3166::Country.
|
83
|
-
code = country.
|
84
|
-
country = ISO3166::Country.new(code)
|
82
|
+
elsif country = ISO3166::Country.find_country_by_any_name(code_or_name)
|
83
|
+
code = country.alpha2
|
85
84
|
end
|
86
85
|
|
87
86
|
unless country.present?
|
@@ -100,11 +99,7 @@ module CountrySelect
|
|
100
99
|
end
|
101
100
|
|
102
101
|
if sorted
|
103
|
-
|
104
|
-
country_list.sort_alphabetical
|
105
|
-
else
|
106
|
-
country_list.sort
|
107
|
-
end
|
102
|
+
country_list.sort_by { |name, code| [I18n.transliterate(name), name] }
|
108
103
|
else
|
109
104
|
country_list
|
110
105
|
end
|