country_select 2.5.2 → 5.0.0.pre

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1dea784fe1d78c8a7b7d35502636b0de1b64879e
4
- data.tar.gz: ca5c6e5be03c82625ae7396a126759b456e5d04f
2
+ SHA256:
3
+ metadata.gz: f7929d56cb96d106c263de9f596ef9d20029854b0c54ca1a9fc94a9a5e8f6bfa
4
+ data.tar.gz: 2acbe530cc471153bffdb7c9f93607447dceb2ffa76b968b18ed85ca327ce8e7
5
5
  SHA512:
6
- metadata.gz: df7361d081db570f9195f0bd04e079a3ddd82a2083bfafb7fe1c9b2c6c20462b986001d17e551b54707a0bf02c5dbef98a178f6a32348b6650160df9e0b8c818
7
- data.tar.gz: 1019eeb1f5d5b9b323bed52bb37253a330829ad09093649b86291b070f67a27efd55406dfbd23f889f246638b923e57d86b0bb51bc087a0cdbab30e9c55de450
6
+ metadata.gz: c93615f51d59bf29e2cbddbacc24cca744509a549c0e8db782b58f98f3983524d43f3288f597b7ffaf391f9722f9b684be78b3100ef79bb858dfc78e82c30030
7
+ data.tar.gz: 9ab7c4635015ba8038a1b63700b895156d5efac80caa44e379dbc62fb876734c82e995c74cb0f72990257564002032f3b2707ab7cef860137109cc384ecc481b
data/.travis.yml CHANGED
@@ -1,31 +1,23 @@
1
- sudo: false
1
+ os: linux
2
2
  cache: bundler
3
3
  language: ruby
4
- script: "bundle exec rspec"
4
+ bundler_args: ""
5
5
  rvm:
6
- - 1.9.3
7
- - 2.0.0
8
- - 2.1.5
9
- - 2.2.1
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/actionpack3.2.gemfile
16
- - gemfiles/actionpack4.0.gemfile
17
- - gemfiles/actionpack4.1.gemfile
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
- matrix:
21
- allow_failures:
22
- - rvm: ruby-head
23
- - rvm: jruby-head
24
- - rvm: rbx-2
16
+ jobs:
25
17
  exclude:
26
- - rvm: 1.9.3
27
- gemfile: gemfiles/actionpack.edge.gemfile
28
- - rvm: 2.0.0
18
+ - rvm: 2.5
29
19
  gemfile: gemfiles/actionpack.edge.gemfile
30
- - rvm: jruby-19mode
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 (2.5.1)
5
- countries (~> 1.2.0)
6
- sort_alphabetical (~> 1.0)
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 (3.2.22)
12
- activemodel (= 3.2.22)
13
- activesupport (= 3.2.22)
14
- builder (~> 3.0.0)
15
- erubis (~> 2.7.0)
16
- journey (~> 1.0.4)
17
- rack (~> 1.4.5)
18
- rack-cache (~> 1.2)
19
- rack-test (~> 0.6.1)
20
- sprockets (~> 2.2.1)
21
- activemodel (3.2.22)
22
- activesupport (= 3.2.22)
23
- builder (~> 3.0.0)
24
- activesupport (3.2.22)
25
- i18n (~> 0.6, >= 0.6.4)
26
- multi_json (~> 1.0)
27
- builder (3.0.4)
28
- coderay (1.1.0)
29
- countries (1.2.1)
30
- currencies (~> 0.4.2)
31
- i18n_data (~> 0.7.0)
32
- currencies (0.4.2)
33
- diff-lcs (1.2.5)
34
- erubis (2.7.0)
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
- hike (1.2.3)
37
- i18n (0.7.0)
38
- i18n_data (0.7.0)
39
- journey (1.0.4)
40
- method_source (0.8.2)
41
- multi_json (1.11.2)
42
- pry (0.10.1)
43
- coderay (~> 1.1.0)
44
- method_source (~> 0.8.1)
45
- slop (~> 3.4)
46
- psych (2.0.15)
47
- racc (1.4.12)
48
- rack (1.4.7)
49
- rack-cache (1.2)
50
- rack (>= 0.4)
51
- rack-test (0.6.3)
52
- rack (>= 1.0)
53
- rake (10.4.2)
54
- rspec (3.3.0)
55
- rspec-core (~> 3.3.0)
56
- rspec-expectations (~> 3.3.0)
57
- rspec-mocks (~> 3.3.0)
58
- rspec-core (3.3.2)
59
- rspec-support (~> 3.3.0)
60
- rspec-expectations (3.3.1)
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.3.0)
63
- rspec-mocks (3.3.2)
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.3.0)
66
- rspec-support (3.3.0)
67
- rubysl (2.1.0)
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.1)
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.0.3)
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.0.8)
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.0.1)
220
+ rubysl-mkmf (2.1)
205
221
  rubysl-fileutils (~> 2.0)
206
222
  rubysl-shellwords (~> 2.0)
207
- rubysl-monitor (2.0.0)
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.3.0)
239
+ rubysl-openssl (2.13)
224
240
  rubysl-optparse (2.0.1)
225
241
  rubysl-shellwords (~> 2.0)
226
- rubysl-ostruct (2.0.4)
227
- rubysl-pathname (2.1.0)
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.0.1)
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.0.1)
245
- rubysl-stringio (2.0.0)
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.0.3)
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
- slop (3.6.0)
267
- sort_alphabetical (1.0.2)
284
+ sixarm_ruby_unaccent (1.2.0)
285
+ sort_alphabetical (1.1.0)
268
286
  unicode_utils (>= 1.2.2)
269
- sprockets (2.2.3)
270
- hike (~> 1.2)
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.1.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 (~> 3)
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.10.6
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 --no-deployment
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: "wwtd:local"
12
+ task default: 'spec'