country_select 2.5.2 → 5.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +14 -22
- data/CHANGELOG.md +25 -0
- data/Gemfile.lock +98 -82
- data/README.md +36 -2
- data/Rakefile +3 -1
- data/country_select.gemspec +8 -8
- data/gemfiles/actionpack.edge.gemfile +0 -6
- data/gemfiles/actionpack.edge.gemfile.lock +78 -281
- data/gemfiles/actionpack5.2.gemfile +6 -0
- data/gemfiles/actionpack5.2.gemfile.lock +106 -0
- data/gemfiles/actionpack6.0.gemfile +6 -0
- data/gemfiles/actionpack6.0.gemfile.lock +108 -0
- data/gemfiles/actionpack6.1.gemfile +6 -0
- data/gemfiles/actionpack6.1.gemfile.lock +107 -0
- data/lib/country_select.rb +1 -6
- data/lib/country_select/formats.rb +1 -1
- data/lib/country_select/tag_helper.rb +17 -2
- data/lib/country_select/version.rb +1 -1
- data/lib/country_select_without_sort_alphabetical.rb +8 -0
- data/spec/country_select_spec.rb +42 -7
- metadata +29 -32
- data/gemfiles/actionpack3.2.gemfile +0 -11
- data/gemfiles/actionpack3.2.gemfile.lock +0 -293
- data/gemfiles/actionpack4.0.gemfile +0 -11
- data/gemfiles/actionpack4.0.gemfile.lock +0 -282
- data/gemfiles/actionpack4.1.gemfile +0 -11
- data/gemfiles/actionpack4.1.gemfile.lock +0 -286
- data/gemfiles/actionpack4.2.gemfile +0 -12
- data/gemfiles/actionpack4.2.gemfile.lock +0 -310
- data/lib/country_select/rails3/country_select_helper.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f7929d56cb96d106c263de9f596ef9d20029854b0c54ca1a9fc94a9a5e8f6bfa
|
4
|
+
data.tar.gz: 2acbe530cc471153bffdb7c9f93607447dceb2ffa76b968b18ed85ca327ce8e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c93615f51d59bf29e2cbddbacc24cca744509a549c0e8db782b58f98f3983524d43f3288f597b7ffaf391f9722f9b684be78b3100ef79bb858dfc78e82c30030
|
7
|
+
data.tar.gz: 9ab7c4635015ba8038a1b63700b895156d5efac80caa44e379dbc62fb876734c82e995c74cb0f72990257564002032f3b2707ab7cef860137109cc384ecc481b
|
data/.travis.yml
CHANGED
@@ -1,31 +1,23 @@
|
|
1
|
-
|
1
|
+
os: linux
|
2
2
|
cache: bundler
|
3
3
|
language: ruby
|
4
|
-
|
4
|
+
bundler_args: ""
|
5
5
|
rvm:
|
6
|
-
-
|
7
|
-
- 2.
|
8
|
-
- 2.
|
9
|
-
-
|
10
|
-
- jruby-19mode
|
11
|
-
- jruby-head
|
12
|
-
- rbx-2
|
6
|
+
- 2.5
|
7
|
+
- 2.6
|
8
|
+
- 2.7
|
9
|
+
- 3.0
|
13
10
|
- ruby-head
|
14
11
|
gemfile:
|
15
|
-
- gemfiles/
|
16
|
-
- gemfiles/
|
17
|
-
- gemfiles/
|
18
|
-
- gemfiles/actionpack4.2.gemfile
|
12
|
+
- gemfiles/actionpack5.2.gemfile
|
13
|
+
- gemfiles/actionpack6.0.gemfile
|
14
|
+
- gemfiles/actionpack6.1.gemfile
|
19
15
|
- gemfiles/actionpack.edge.gemfile
|
20
|
-
|
21
|
-
allow_failures:
|
22
|
-
- rvm: ruby-head
|
23
|
-
- rvm: jruby-head
|
24
|
-
- rvm: rbx-2
|
16
|
+
jobs:
|
25
17
|
exclude:
|
26
|
-
- rvm:
|
27
|
-
gemfile: gemfiles/actionpack.edge.gemfile
|
28
|
-
- rvm: 2.0.0
|
18
|
+
- rvm: 2.5
|
29
19
|
gemfile: gemfiles/actionpack.edge.gemfile
|
30
|
-
- rvm:
|
20
|
+
- rvm: 2.6
|
31
21
|
gemfile: gemfiles/actionpack.edge.gemfile
|
22
|
+
allow_failures:
|
23
|
+
- rvm: ruby-head
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
+
## 5.0.0 2021-03-03
|
2
|
+
|
3
|
+
* #164,#172 - Remove support for EOL versions of Ruby and ruby on rails
|
4
|
+
* Ruby >= 2.5, Rails >= 5.2
|
5
|
+
* #175 - Add Rails 6.1 Support *(@andrehjr)
|
6
|
+
* #173 - Fallback even if translations cannot be loaded (@mikepluquin)
|
7
|
+
|
8
|
+
## 4.0.0 2018-12-20
|
9
|
+
|
10
|
+
* #160 - Upgrade to countries 3.0 - @gssbzn
|
11
|
+
* https://github.com/hexorx/countries/blob/master/CHANGELOG.md#v220-yanked-and-re-released-as-300-20181217-1020-0000
|
12
|
+
|
13
|
+
## 3.1.1 2017-09-20
|
14
|
+
|
15
|
+
* #146 - Fix value call on Rails edge (5.2+) - @ybart
|
16
|
+
|
17
|
+
## 3.1.0 2017-07-18
|
18
|
+
|
19
|
+
* #144 - Provide a possibility to opt out of `sort_alphabetical` - @fschwahn
|
20
|
+
|
21
|
+
## 3.0.0 2016-11-25
|
22
|
+
|
23
|
+
* #138 - Upgrade to Countries 2.0
|
24
|
+
* #136 - Drop support for Ruby 1.9.3 as countries 2.0 no longer supports it
|
25
|
+
|
1
26
|
## 2.5.2 2015-11-10
|
2
27
|
|
3
28
|
* #127 - Fix multi-selects - @jjballano
|
data/Gemfile.lock
CHANGED
@@ -1,70 +1,85 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
country_select (
|
5
|
-
countries (~>
|
6
|
-
sort_alphabetical (~> 1.
|
4
|
+
country_select (5.0.0.pre)
|
5
|
+
countries (~> 3.0)
|
6
|
+
sort_alphabetical (~> 1.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionpack (
|
12
|
-
|
13
|
-
activesupport (=
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
activesupport (
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
11
|
+
actionpack (6.1.1)
|
12
|
+
actionview (= 6.1.1)
|
13
|
+
activesupport (= 6.1.1)
|
14
|
+
rack (~> 2.0, >= 2.0.9)
|
15
|
+
rack-test (>= 0.6.3)
|
16
|
+
rails-dom-testing (~> 2.0)
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
+
actionview (6.1.1)
|
19
|
+
activesupport (= 6.1.1)
|
20
|
+
builder (~> 3.1)
|
21
|
+
erubi (~> 1.4)
|
22
|
+
rails-dom-testing (~> 2.0)
|
23
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
+
activesupport (6.1.1)
|
25
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
|
+
i18n (>= 1.6, < 2)
|
27
|
+
minitest (>= 5.1)
|
28
|
+
tzinfo (~> 2.0)
|
29
|
+
zeitwerk (~> 2.3)
|
30
|
+
builder (3.2.4)
|
31
|
+
coderay (1.1.3)
|
32
|
+
concurrent-ruby (1.1.8)
|
33
|
+
countries (3.0.1)
|
34
|
+
i18n_data (~> 0.10.0)
|
35
|
+
sixarm_ruby_unaccent (~> 1.1)
|
36
|
+
unicode_utils (~> 1.4)
|
37
|
+
crass (1.0.6)
|
38
|
+
diff-lcs (1.4.4)
|
39
|
+
erubi (1.10.0)
|
35
40
|
ffi2-generators (0.1.1)
|
36
|
-
|
37
|
-
|
38
|
-
i18n_data (0.
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
41
|
+
i18n (1.8.7)
|
42
|
+
concurrent-ruby (~> 1.0)
|
43
|
+
i18n_data (0.10.0)
|
44
|
+
loofah (2.9.0)
|
45
|
+
crass (~> 1.0.2)
|
46
|
+
nokogiri (>= 1.5.9)
|
47
|
+
method_source (1.0.0)
|
48
|
+
mini_portile2 (2.5.0)
|
49
|
+
minitest (5.14.3)
|
50
|
+
nokogiri (1.11.1)
|
51
|
+
mini_portile2 (~> 2.5.0)
|
52
|
+
racc (~> 1.4)
|
53
|
+
nokogiri (1.11.1-x86_64-darwin)
|
54
|
+
racc (~> 1.4)
|
55
|
+
pry (0.13.1)
|
56
|
+
coderay (~> 1.1)
|
57
|
+
method_source (~> 1.0)
|
58
|
+
psych (3.2.0)
|
59
|
+
racc (1.5.0)
|
60
|
+
rack (2.2.3)
|
61
|
+
rack-test (1.1.0)
|
62
|
+
rack (>= 1.0, < 3)
|
63
|
+
rails-dom-testing (2.0.3)
|
64
|
+
activesupport (>= 4.2.0)
|
65
|
+
nokogiri (>= 1.6)
|
66
|
+
rails-html-sanitizer (1.3.0)
|
67
|
+
loofah (~> 2.3)
|
68
|
+
rake (13.0.1)
|
69
|
+
rspec (3.9.0)
|
70
|
+
rspec-core (~> 3.9.0)
|
71
|
+
rspec-expectations (~> 3.9.0)
|
72
|
+
rspec-mocks (~> 3.9.0)
|
73
|
+
rspec-core (3.9.2)
|
74
|
+
rspec-support (~> 3.9.3)
|
75
|
+
rspec-expectations (3.9.2)
|
61
76
|
diff-lcs (>= 1.2.0, < 2.0)
|
62
|
-
rspec-support (~> 3.
|
63
|
-
rspec-mocks (3.
|
77
|
+
rspec-support (~> 3.9.0)
|
78
|
+
rspec-mocks (3.9.1)
|
64
79
|
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
-
rspec-support (~> 3.
|
66
|
-
rspec-support (3.3
|
67
|
-
rubysl (2.
|
80
|
+
rspec-support (~> 3.9.0)
|
81
|
+
rspec-support (3.9.3)
|
82
|
+
rubysl (2.2.0)
|
68
83
|
rubysl-abbrev (~> 2.0)
|
69
84
|
rubysl-base64 (~> 2.0)
|
70
85
|
rubysl-benchmark (~> 2.0)
|
@@ -149,6 +164,7 @@ GEM
|
|
149
164
|
rubysl-tmpdir (~> 2.0)
|
150
165
|
rubysl-tsort (~> 2.0)
|
151
166
|
rubysl-un (~> 2.0)
|
167
|
+
rubysl-unicode_normalize (~> 2.0)
|
152
168
|
rubysl-uri (~> 2.0)
|
153
169
|
rubysl-weakref (~> 2.0)
|
154
170
|
rubysl-webrick (~> 2.0)
|
@@ -160,17 +176,17 @@ GEM
|
|
160
176
|
rubysl-benchmark (2.0.1)
|
161
177
|
rubysl-bigdecimal (2.0.2)
|
162
178
|
rubysl-cgi (2.0.1)
|
163
|
-
rubysl-cgi-session (2.0
|
179
|
+
rubysl-cgi-session (2.1.0)
|
164
180
|
rubysl-cmath (2.0.0)
|
165
181
|
rubysl-complex (2.0.0)
|
166
182
|
rubysl-continuation (2.0.0)
|
167
|
-
rubysl-coverage (2.
|
183
|
+
rubysl-coverage (2.1)
|
168
184
|
rubysl-csv (2.0.2)
|
169
185
|
rubysl-english (~> 2.0)
|
170
186
|
rubysl-curses (2.0.1)
|
171
187
|
rubysl-date (2.0.9)
|
172
188
|
rubysl-delegate (2.0.1)
|
173
|
-
rubysl-digest (2.
|
189
|
+
rubysl-digest (2.1)
|
174
190
|
rubysl-drb (2.0.1)
|
175
191
|
rubysl-e2mmap (2.0.0)
|
176
192
|
rubysl-english (2.0.0)
|
@@ -201,10 +217,10 @@ GEM
|
|
201
217
|
rubysl-mathn (2.0.0)
|
202
218
|
rubysl-matrix (2.1.0)
|
203
219
|
rubysl-e2mmap (~> 2.0)
|
204
|
-
rubysl-mkmf (2.
|
220
|
+
rubysl-mkmf (2.1)
|
205
221
|
rubysl-fileutils (~> 2.0)
|
206
222
|
rubysl-shellwords (~> 2.0)
|
207
|
-
rubysl-monitor (2.
|
223
|
+
rubysl-monitor (2.1)
|
208
224
|
rubysl-mutex_m (2.0.0)
|
209
225
|
rubysl-net-ftp (2.0.1)
|
210
226
|
rubysl-net-http (2.0.4)
|
@@ -220,15 +236,15 @@ GEM
|
|
220
236
|
rubysl-observer (2.0.0)
|
221
237
|
rubysl-open-uri (2.0.0)
|
222
238
|
rubysl-open3 (2.0.0)
|
223
|
-
rubysl-openssl (2.
|
239
|
+
rubysl-openssl (2.13)
|
224
240
|
rubysl-optparse (2.0.1)
|
225
241
|
rubysl-shellwords (~> 2.0)
|
226
|
-
rubysl-ostruct (2.0
|
227
|
-
rubysl-pathname (2.
|
242
|
+
rubysl-ostruct (2.1.0)
|
243
|
+
rubysl-pathname (2.3)
|
228
244
|
rubysl-prettyprint (2.0.3)
|
229
245
|
rubysl-prime (2.0.1)
|
230
246
|
rubysl-profile (2.0.0)
|
231
|
-
rubysl-profiler (2.
|
247
|
+
rubysl-profiler (2.1)
|
232
248
|
rubysl-pstore (2.0.0)
|
233
249
|
rubysl-pty (2.0.3)
|
234
250
|
rubysl-rational (2.0.1)
|
@@ -241,14 +257,15 @@ GEM
|
|
241
257
|
rubysl-set (2.0.1)
|
242
258
|
rubysl-shellwords (2.0.0)
|
243
259
|
rubysl-singleton (2.0.0)
|
244
|
-
rubysl-socket (2.
|
245
|
-
|
260
|
+
rubysl-socket (2.2.1)
|
261
|
+
rubysl-fcntl (~> 2.0)
|
262
|
+
rubysl-stringio (2.3)
|
246
263
|
rubysl-strscan (2.0.0)
|
247
264
|
rubysl-sync (2.0.0)
|
248
265
|
rubysl-syslog (2.1.0)
|
249
266
|
ffi2-generators (~> 0.1)
|
250
267
|
rubysl-tempfile (2.0.1)
|
251
|
-
rubysl-thread (2.
|
268
|
+
rubysl-thread (2.1)
|
252
269
|
rubysl-thwait (2.0.0)
|
253
270
|
rubysl-time (2.0.3)
|
254
271
|
rubysl-timeout (2.0.0)
|
@@ -257,37 +274,36 @@ GEM
|
|
257
274
|
rubysl-un (2.0.0)
|
258
275
|
rubysl-fileutils (~> 2.0)
|
259
276
|
rubysl-optparse (~> 2.0)
|
277
|
+
rubysl-unicode_normalize (2.0)
|
260
278
|
rubysl-uri (2.0.0)
|
261
279
|
rubysl-weakref (2.0.0)
|
262
280
|
rubysl-webrick (2.0.0)
|
263
281
|
rubysl-xmlrpc (2.0.0)
|
264
282
|
rubysl-yaml (2.1.0)
|
265
283
|
rubysl-zlib (2.0.1)
|
266
|
-
|
267
|
-
sort_alphabetical (1.0
|
284
|
+
sixarm_ruby_unaccent (1.2.0)
|
285
|
+
sort_alphabetical (1.1.0)
|
268
286
|
unicode_utils (>= 1.2.2)
|
269
|
-
|
270
|
-
|
271
|
-
multi_json (~> 1.0)
|
272
|
-
rack (~> 1.0)
|
273
|
-
tilt (~> 1.1, != 1.3.0)
|
274
|
-
tilt (1.4.1)
|
287
|
+
tzinfo (2.0.4)
|
288
|
+
concurrent-ruby (~> 1.0)
|
275
289
|
unicode_utils (1.4.0)
|
276
|
-
wwtd (1.
|
290
|
+
wwtd (1.4.1)
|
291
|
+
zeitwerk (2.4.2)
|
277
292
|
|
278
293
|
PLATFORMS
|
279
294
|
ruby
|
295
|
+
x86_64-darwin-19
|
280
296
|
|
281
297
|
DEPENDENCIES
|
282
|
-
actionpack (~>
|
298
|
+
actionpack (~> 6.1)
|
283
299
|
country_select!
|
284
300
|
pry (~> 0)
|
285
301
|
psych
|
286
302
|
racc
|
287
|
-
rake
|
303
|
+
rake (~> 13)
|
288
304
|
rspec (~> 3)
|
289
305
|
rubysl (~> 2.0)
|
290
|
-
wwtd
|
306
|
+
wwtd (~> 1)
|
291
307
|
|
292
308
|
BUNDLED WITH
|
293
|
-
1.
|
309
|
+
2.1.4
|
data/README.md
CHANGED
@@ -26,11 +26,25 @@ gem install country_select
|
|
26
26
|
Or put the following in your Gemfile
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
gem 'country_select'
|
29
|
+
gem 'country_select', '~> 4.0'
|
30
|
+
```
|
31
|
+
|
32
|
+
If you don't want to require `sort_alphabetical` (it depends on `unicode_utils` which is known to use lots of memory) you can opt out of using it as follows:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
gem 'country_select', require: 'country_select_without_sort_alphabetical'
|
30
36
|
```
|
31
37
|
|
32
38
|
## Usage
|
33
39
|
|
40
|
+
Within `form_for` you can use this select like other form elements:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
<%= form_for User.new, url: root_url do |f| %>
|
44
|
+
<%= f.country_select :country_code %>
|
45
|
+
<% end %>
|
46
|
+
```
|
47
|
+
|
34
48
|
Simple use supplying model and attribute as parameters:
|
35
49
|
|
36
50
|
```ruby
|
@@ -61,6 +75,11 @@ Pre-selecting a particular country:
|
|
61
75
|
country_select("user", "country", selected: "GB")
|
62
76
|
```
|
63
77
|
|
78
|
+
Changing the divider when priority_countries is active.
|
79
|
+
```ruby
|
80
|
+
country_select("user", "country", priority_countries: ["AR", "US"], priority_countries_divider: "~~~~~~")
|
81
|
+
```
|
82
|
+
|
64
83
|
Using existing `select` options:
|
65
84
|
```ruby
|
66
85
|
country_select("user", "country", include_blank: true)
|
@@ -79,13 +98,28 @@ You can define a custom formatter which will receive an
|
|
79
98
|
[`ISO3166::Country`](https://github.com/hexorx/countries/blob/master/lib/countries/country.rb)
|
80
99
|
```ruby
|
81
100
|
# config/initializers/country_select.rb
|
101
|
+
|
102
|
+
# Return a string to customize the text in the <option> tag, `value` attribute will remain unchanged
|
82
103
|
CountrySelect::FORMATS[:with_alpha2] = lambda do |country|
|
83
104
|
"#{country.name} (#{country.alpha2})"
|
84
105
|
end
|
106
|
+
|
107
|
+
# Return an array to customize <option> text, `value` and other HTML attributes
|
108
|
+
CountrySelect::FORMATS[:with_data_attrs] = lambda do |country|
|
109
|
+
[
|
110
|
+
country.name,
|
111
|
+
country.alpha2,
|
112
|
+
{
|
113
|
+
'data-country-code' => country.country_code,
|
114
|
+
'data-alpha3' => country.alpha3
|
115
|
+
}
|
116
|
+
]
|
117
|
+
end
|
85
118
|
```
|
86
119
|
|
87
120
|
```ruby
|
88
121
|
country_select("user", "country", format: :with_alpha2)
|
122
|
+
country_select("user", "country", format: :with_data_attrs)
|
89
123
|
```
|
90
124
|
|
91
125
|
### ISO 3166-1 alpha-2 codes
|
@@ -159,7 +193,7 @@ changing the dependencies in the gemspec.
|
|
159
193
|
```shell
|
160
194
|
for i in gemfiles/*.gemfile
|
161
195
|
do
|
162
|
-
BUNDLE_GEMFILE=$i bundle install --
|
196
|
+
BUNDLE_GEMFILE=$i bundle install --local
|
163
197
|
done
|
164
198
|
```
|
165
199
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/setup'
|
2
4
|
require 'rake'
|
3
5
|
require 'bundler/gem_tasks'
|
@@ -7,4 +9,4 @@ require 'wwtd/tasks'
|
|
7
9
|
require 'rspec/core/rake_task'
|
8
10
|
RSpec::Core::RakeTask.new(:spec)
|
9
11
|
|
10
|
-
task default:
|
12
|
+
task default: 'spec'
|