country_select 1.1.3 → 2.0.0.rc1
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
- data/.gitignore +2 -0
- data/.rspec +2 -0
- data/.travis.yml +24 -0
- data/Appraisals +19 -0
- data/CHANGELOG.md +30 -0
- data/Gemfile +7 -3
- data/README.md +102 -14
- data/Rakefile +20 -1
- data/UPGRADING.md +69 -0
- data/country_select.gemspec +15 -11
- data/gemfiles/actionpack3.0.gemfile +13 -0
- data/gemfiles/actionpack3.1.gemfile +13 -0
- data/gemfiles/actionpack3.2.gemfile +13 -0
- data/gemfiles/actionpack4.0.gemfile +13 -0
- data/gemfiles/actionpack4.1.gemfile +13 -0
- data/lib/country_select/country_select_helper.rb +38 -0
- data/lib/country_select/rails3/country_select_helper.rb +39 -0
- data/lib/country_select/tag_helper.rb +88 -0
- data/lib/country_select/version.rb +1 -1
- data/lib/country_select.rb +8 -101
- data/spec/country_select_spec.rb +139 -0
- data/spec/spec_helper.rb +20 -0
- metadata +113 -22
- data/VERSION +0 -1
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 401df54254b9c4583008b5911cccf52b5b3f2e58
|
|
4
|
+
data.tar.gz: 11545a1a878be17f4ecc0702f02d62654119469d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 673e9a647e516829b6aa503463d0af4d37fbbdad31fc94cedd4f98783947373d6eec776ac1521607113d7473dceb58bf22690c0a6f9c7525734557375da3ad23
|
|
7
|
+
data.tar.gz: 7a33b1de4fed4658a9cc9b6e0e13d98f4d9ac4ed094ceb239884369c823a336fbf04dc83eee7f030fee818069e741b5f036914ff19f32a7ba1c10f511facde3e
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.travis.yml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
language: ruby
|
|
2
|
+
script: "bundle exec rake appraisal:integration"
|
|
3
|
+
rvm:
|
|
4
|
+
- 1.9.3
|
|
5
|
+
- 2.0.0
|
|
6
|
+
- 2.1.2
|
|
7
|
+
- jruby-19mode
|
|
8
|
+
- jruby-head
|
|
9
|
+
- rbx-2
|
|
10
|
+
- ruby-head
|
|
11
|
+
gemfile:
|
|
12
|
+
- gemfiles/actionpack3.2.gemfile
|
|
13
|
+
- gemfiles/actionpack4.0.gemfile
|
|
14
|
+
- gemfiles/actionpack4.1.gemfile
|
|
15
|
+
matrix:
|
|
16
|
+
exclude:
|
|
17
|
+
- rvm: 1.9.3
|
|
18
|
+
gemfile: gemfiles/actionpack4.0.gemfile
|
|
19
|
+
- rvm: 1.9.3
|
|
20
|
+
gemfile: gemfiles/actionpack4.1.gemfile
|
|
21
|
+
allow_failures:
|
|
22
|
+
- rvm: ruby-head
|
|
23
|
+
- rvm: jruby-head
|
|
24
|
+
- rvm: rbx-2
|
data/Appraisals
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
appraise 'actionpack3.0' do
|
|
2
|
+
gem 'actionpack', '~> 3.0.20'
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
appraise 'actionpack3.1' do
|
|
6
|
+
gem 'actionpack', '~> 3.1.12'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
appraise 'actionpack3.2' do
|
|
10
|
+
gem 'actionpack', '~> 3.2.17'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
appraise 'actionpack4.0' do
|
|
14
|
+
gem 'actionpack', '~> 4.0.0'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
appraise 'actionpack4.1' do
|
|
18
|
+
gem 'actionpack', '~> 4.1.0'
|
|
19
|
+
end
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
== 2.0.0 2014-08-10
|
|
2
|
+
|
|
3
|
+
* Removed support for Ruby < 1.9.3
|
|
4
|
+
* ISO-3166 alpha-2 codes are now on by default, stored in uppercase
|
|
5
|
+
(e.g., US)
|
|
6
|
+
* Localization is always on
|
|
7
|
+
* The `country_select` method will always attempt to localize
|
|
8
|
+
country names based on the value of `I18n.locale` via translations
|
|
9
|
+
stored in the `countries` gem
|
|
10
|
+
* Priority countries should now be set via the `priority_countries` option
|
|
11
|
+
* The original 1.x syntax is still available
|
|
12
|
+
* The list of countries can now be limited with the `only` and
|
|
13
|
+
`except` options
|
|
14
|
+
* Add best-guess support for country names when codes aren't provided
|
|
15
|
+
in options (e.g., priority_countries)
|
|
16
|
+
|
|
17
|
+
== 1.2.0 2013-07-06
|
|
18
|
+
|
|
19
|
+
* Country names have been synced with UTF-8 encoding to the list of
|
|
20
|
+
countries on [Wikipedia's page for the ISO-3166 standard](https://en.wikipedia.org/wiki/ISO_3166-1).
|
|
21
|
+
* NOTE: This could be a breaking change with some of the country
|
|
22
|
+
names that have been fixed since the list was last updated.
|
|
23
|
+
* For more information you can checkout all country mappings with
|
|
24
|
+
`::CountrySelect::COUNTRIES`
|
|
25
|
+
|
|
26
|
+
* You can now store your country values using the
|
|
27
|
+
[ISO-3166 Alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
|
|
28
|
+
with the `iso_codes` option. See the README.md for details.
|
|
29
|
+
* This should help alleviate the problem of country names
|
|
30
|
+
in ISO-3166 being changed and/or corrected.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,34 +1,122 @@
|
|
|
1
|
-
|
|
1
|
+
# Rails – Country Select
|
|
2
|
+
[](https://travis-ci.org/stefanpenner/country_select)
|
|
2
3
|
|
|
3
|
-
Provides a simple helper to get an HTML select list of countries
|
|
4
|
-
|
|
5
|
-
still offend some users.
|
|
4
|
+
Provides a simple helper to get an HTML select list of countries using the
|
|
5
|
+
[ISO 3166-1 standard](https://en.wikipedia.org/wiki/ISO_3166-1).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
While the ISO 3166 standard is a relatively neutral source of country
|
|
8
|
+
names, it may still offend some users. Developers are strongly advised
|
|
9
|
+
to evaluate the suitability of this list given their user base.
|
|
10
|
+
|
|
11
|
+
## UPGRADING
|
|
12
|
+
|
|
13
|
+
[**An important message about upgrading from 1.x**](UPGRADING.md)
|
|
8
14
|
|
|
9
15
|
## Installation
|
|
10
16
|
|
|
11
17
|
Install as a gem using
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
```shell
|
|
20
|
+
gem install country_select
|
|
21
|
+
```
|
|
15
22
|
Or put the following in your Gemfile
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
```ruby
|
|
25
|
+
gem 'country_select', github: 'stefanpenner/country_select'
|
|
26
|
+
```
|
|
18
27
|
|
|
19
|
-
##
|
|
28
|
+
## Usage
|
|
20
29
|
|
|
21
30
|
Simple use supplying model and attribute as parameters:
|
|
22
31
|
|
|
23
|
-
|
|
32
|
+
```ruby
|
|
33
|
+
country_select("user", "country")
|
|
34
|
+
```
|
|
24
35
|
|
|
25
36
|
Supplying priority countries to be placed at the top of the list:
|
|
26
37
|
|
|
27
|
-
|
|
38
|
+
```ruby
|
|
39
|
+
country_select("user", "country", priority_countries: ["GB", "FR", "DE"])
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Supplying only certain countries:
|
|
43
|
+
|
|
44
|
+
```ruby
|
|
45
|
+
country_select("user", "country", only: ["GB", "FR", "DE"])
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Discarding certain countries:
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
country_select("user", "country", except: ["GB", "FR", "DE"])
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Supplying additional html options:
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
country_select("user", "country", { priority_countries: ["GB", "FR"] }, { selected: "GB", class: 'form-control' })
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### ISO 3166-1 alpha-2 codes
|
|
61
|
+
The `option` tags use ISO 3166-1 alpha-2 codes as values and the country
|
|
62
|
+
names as display strings. For example, the United States would appear as
|
|
63
|
+
`<option value="US">United States of America</option>`
|
|
64
|
+
|
|
65
|
+
Country names are automatically localized based on the value of
|
|
66
|
+
`I18n.locale` thanks to the wonderful
|
|
67
|
+
[countries gem](https://github.com/hexorx/countries/).
|
|
68
|
+
|
|
69
|
+
Current translations include:
|
|
70
|
+
|
|
71
|
+
* en
|
|
72
|
+
* de
|
|
73
|
+
* es
|
|
74
|
+
* fr
|
|
75
|
+
* it
|
|
76
|
+
* ja
|
|
77
|
+
* nl
|
|
78
|
+
|
|
79
|
+
In the event a translation is not available, it will revert to the
|
|
80
|
+
globally assigned locale (by default, "en").
|
|
81
|
+
|
|
82
|
+
This is the only way to use `country_select` as of version `2.0`. It
|
|
83
|
+
is the recommended way to store your country data since it will be
|
|
84
|
+
resistant to country names changing.
|
|
85
|
+
|
|
86
|
+
The locale can be overridden locally:
|
|
87
|
+
|
|
88
|
+
```ruby
|
|
89
|
+
country_select("user", "country_code", locale: 'es')
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Getting the Country Name from the countries gem
|
|
93
|
+
|
|
94
|
+
```ruby
|
|
95
|
+
class User < ActiveRecord::Base
|
|
96
|
+
|
|
97
|
+
# Assuming country_select is used with User attribute `country_code`
|
|
98
|
+
# This will attempt to translate the country name and use the default
|
|
99
|
+
# (usually English) name if no translation is available
|
|
100
|
+
def country_name
|
|
101
|
+
country = ISO3166::Country[country_code]
|
|
102
|
+
country.translations[I18n.locale.to_s] || country.name
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
end
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Example Application
|
|
109
|
+
|
|
110
|
+
An example Rails application demonstrating the different options is
|
|
111
|
+
available at [scudco/country_select_test](https://github.com/scudco/country_select_test).
|
|
112
|
+
The relevant view files live [here](https://github.com/scudco/country_select_test/tree/master/app/views/welcome).
|
|
28
113
|
|
|
29
|
-
|
|
30
|
-
United Kingdom will be selected.
|
|
114
|
+
## Tests
|
|
31
115
|
|
|
32
|
-
|
|
116
|
+
```shell
|
|
117
|
+
bundle
|
|
118
|
+
bundle exec appraisal
|
|
119
|
+
bundle exec rake appraisal:integration
|
|
120
|
+
```
|
|
33
121
|
|
|
34
122
|
Copyright (c) 2008 Michael Koziarski, released under the MIT license
|
data/Rakefile
CHANGED
|
@@ -1 +1,20 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
4
|
+
|
|
5
|
+
require 'appraisal'
|
|
6
|
+
|
|
7
|
+
require 'rspec/core/rake_task'
|
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
9
|
+
|
|
10
|
+
task default: :spec
|
|
11
|
+
|
|
12
|
+
namespace :appraisal do
|
|
13
|
+
desc "Run the given task for a particular integration's appraisals"
|
|
14
|
+
task :integration do
|
|
15
|
+
Appraisal::File.each do |appraisal|
|
|
16
|
+
appraisal.install
|
|
17
|
+
Appraisal::Command.from_args(appraisal.gemfile_path).run
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/UPGRADING.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Upgrading from 1.x
|
|
2
|
+
|
|
3
|
+
`country_select` 2.0 has brought a few small changes, but these changes
|
|
4
|
+
can have a big impact on existing production systems. Please read these
|
|
5
|
+
points carefully and consider whether upgrading to 2.0 is a good idea.
|
|
6
|
+
|
|
7
|
+
Please post any implications we may have missed as a GitHub Issue
|
|
8
|
+
or Pull Request.
|
|
9
|
+
|
|
10
|
+
## ISO codes are always on
|
|
11
|
+
|
|
12
|
+
If you upgrade to 2.0 and are currently storing countries by the names
|
|
13
|
+
produced by this gem, your setup will break. It is recommended that you
|
|
14
|
+
stick with 1.x until developing a data migration strategy that allows
|
|
15
|
+
you to map your existing country names to country codes.
|
|
16
|
+
|
|
17
|
+
## i18n country names are always on (when available)
|
|
18
|
+
|
|
19
|
+
Country names will be generated using `I18n.locale` if a translation
|
|
20
|
+
from the countries gem is available.
|
|
21
|
+
|
|
22
|
+
## Codes are UPCASED
|
|
23
|
+
|
|
24
|
+
The official ISO 3166-1 standard uses UPCASED codes. This is an easy
|
|
25
|
+
data change, but may affect areas of code dependent on lowercase country
|
|
26
|
+
codes.
|
|
27
|
+
|
|
28
|
+
Here's a sample SQL migration that could address a `users` table with
|
|
29
|
+
lowercased country codes stored in the `country_code` column:
|
|
30
|
+
|
|
31
|
+
```sql
|
|
32
|
+
UPDATE users SET country_code = UPPER(country_code);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Priority countries are now in the options hash
|
|
36
|
+
|
|
37
|
+
The priority countries syntax has changed from
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
country_select(:user, :country_code, ["GB","FR"])
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
to
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
country_select(:user, :country_code, priority_countries: ["GB","FR"])
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### A note on 1.x Syntax
|
|
50
|
+
|
|
51
|
+
In order to seamlessly support popular libraries dependent on
|
|
52
|
+
`country_select`, specifically `formatstic` and `simple_form`, 1.x
|
|
53
|
+
priority syntax is still supported, but will probably be removed in the
|
|
54
|
+
next major release (i.e., 3.0). We'll be working with `simple_form` and
|
|
55
|
+
`formtastic` maintainers to transition away from the old 1.x syntax.
|
|
56
|
+
|
|
57
|
+
## You can choose to only display a chosen set of countries
|
|
58
|
+
|
|
59
|
+
```ruby
|
|
60
|
+
country_select(:user, :country_code, only: ["LV","SG"])
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
country_select(:user, :country_code, except: ["US","GB"])
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Ruby 1.9+
|
|
68
|
+
|
|
69
|
+
`country_select` will no longer be tested in Ruby `< 1.9`.
|
data/country_select.gemspec
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
$:.push File.expand_path(
|
|
3
|
-
require
|
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
|
3
|
+
require 'country_select/version'
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |s|
|
|
6
|
-
s.name =
|
|
6
|
+
s.name = 'country_select'
|
|
7
7
|
s.version = CountrySelect::VERSION
|
|
8
|
-
s.
|
|
9
|
-
s.
|
|
10
|
-
s.
|
|
8
|
+
s.licenses = ['MIT']
|
|
9
|
+
s.authors = ['Stefan Penner']
|
|
10
|
+
s.email = ['stefan.penner@gmail.com']
|
|
11
|
+
s.homepage = 'https://github.com/stefanpenner/country_select'
|
|
11
12
|
s.summary = %q{Country Select Plugin}
|
|
12
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.}
|
|
13
14
|
|
|
14
|
-
s.rubyforge_project =
|
|
15
|
+
s.rubyforge_project = 'country_select'
|
|
15
16
|
|
|
16
17
|
s.files = `git ls-files`.split("\n")
|
|
17
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
18
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
19
|
-
s.require_paths = [
|
|
20
|
+
s.require_paths = ['lib']
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
s.add_development_dependency 'rspec', '~> 2'
|
|
23
|
+
s.add_development_dependency 'actionpack', '~> 3'
|
|
24
|
+
s.add_development_dependency 'appraisal', '~> 1.0', '>= 1.0.0'
|
|
25
|
+
s.add_development_dependency 'pry', '~> 0'
|
|
26
|
+
|
|
27
|
+
s.add_dependency 'countries', '~> 0.9', '>= 0.9.3'
|
|
24
28
|
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module ActionView
|
|
2
|
+
module Helpers
|
|
3
|
+
class FormBuilder
|
|
4
|
+
def country_select(method, priority_or_options = {}, options = {}, html_options = {})
|
|
5
|
+
if Hash === priority_or_options
|
|
6
|
+
html_options = options
|
|
7
|
+
options = priority_or_options
|
|
8
|
+
else
|
|
9
|
+
options[:priority_countries] = priority_or_options
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
@template.country_select(@object_name, method, objectify_options(options), @default_options.merge(html_options))
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module FormOptionsHelper
|
|
17
|
+
def country_select(object, method, options = {}, html_options = {})
|
|
18
|
+
Tags::CountrySelect.new(object, method, self, options, html_options).render
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
module Tags
|
|
23
|
+
class CountrySelect < Base
|
|
24
|
+
include ::CountrySelect::TagHelper
|
|
25
|
+
|
|
26
|
+
def initialize(object_name, method_name, template_object, options, html_options)
|
|
27
|
+
@html_options = html_options
|
|
28
|
+
|
|
29
|
+
super(object_name, method_name, template_object, options)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def render
|
|
33
|
+
select_content_tag(country_option_tags, @options, @html_options)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module ActionView
|
|
2
|
+
module Helpers
|
|
3
|
+
class FormBuilder
|
|
4
|
+
def country_select(method, priority_or_options = {}, options = {}, html_options = {})
|
|
5
|
+
if Hash === priority_or_options
|
|
6
|
+
html_options = options
|
|
7
|
+
options = priority_or_options
|
|
8
|
+
else
|
|
9
|
+
options[:priority_countries] = priority_or_options
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
@template.country_select(@object_name, method, objectify_options(options), @default_options.merge(html_options))
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module FormOptionsHelper
|
|
17
|
+
def country_select(object, method, options = {}, html_options = {})
|
|
18
|
+
CountrySelect.new(object, method, self, options.delete(:object)).render(options, html_options)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class CountrySelect < InstanceTag
|
|
23
|
+
include ::CountrySelect::TagHelper
|
|
24
|
+
|
|
25
|
+
def render(options, html_options)
|
|
26
|
+
@options = options
|
|
27
|
+
@html_options = html_options
|
|
28
|
+
|
|
29
|
+
if self.respond_to?(:select_content_tag)
|
|
30
|
+
select_content_tag(country_option_tags, @options, @html_options)
|
|
31
|
+
else
|
|
32
|
+
html_options = @html_options.stringify_keys
|
|
33
|
+
add_default_name_and_id(html_options)
|
|
34
|
+
content_tag(:select, country_option_tags, html_options)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
module CountrySelect
|
|
2
|
+
module TagHelper
|
|
3
|
+
def country_option_tags
|
|
4
|
+
option_tags_options = {
|
|
5
|
+
:selected => @options.fetch(:selected) { value(@object) },
|
|
6
|
+
:disabled => @options[:disabled]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if priority_countries.present?
|
|
10
|
+
priority_countries_options = country_options_for(priority_countries, false)
|
|
11
|
+
|
|
12
|
+
option_tags = options_for_select(priority_countries_options, option_tags_options)
|
|
13
|
+
option_tags += html_safe_newline + options_for_select([priority_countries_divider], disabled: priority_countries_divider)
|
|
14
|
+
|
|
15
|
+
if priority_countries.include?(option_tags_options[:selected])
|
|
16
|
+
option_tags_options[:selected] = nil
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
option_tags += html_safe_newline + options_for_select(country_options, option_tags_options)
|
|
20
|
+
else
|
|
21
|
+
option_tags = options_for_select(country_options, option_tags_options)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
def locale
|
|
27
|
+
@options[:locale]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def priority_countries
|
|
31
|
+
@options[:priority_countries]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def priority_countries_divider
|
|
35
|
+
@options[:priority_countries_divider] || "-"*15
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def only_country_codes
|
|
39
|
+
@options[:only]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def except_country_codes
|
|
43
|
+
@options[:except]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def country_options
|
|
47
|
+
country_options_for(all_country_codes, true)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def all_country_codes
|
|
51
|
+
codes = ISO3166::Country.all.map(&:last)
|
|
52
|
+
|
|
53
|
+
if only_country_codes.present?
|
|
54
|
+
codes & only_country_codes
|
|
55
|
+
elsif except_country_codes.present?
|
|
56
|
+
codes - except_country_codes
|
|
57
|
+
else
|
|
58
|
+
codes
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def country_options_for(country_codes, sorted=true)
|
|
63
|
+
I18n.with_locale(locale) do
|
|
64
|
+
country_list = country_codes.map do |code|
|
|
65
|
+
code = code.to_s.upcase
|
|
66
|
+
|
|
67
|
+
unless country = ISO3166::Country.new(code)
|
|
68
|
+
code = ISO3166::Country.find_by_name(code).first
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
country ||= ISO3166::Country.new(code)
|
|
72
|
+
default_name = country.name
|
|
73
|
+
localized_name = country.translations[I18n.locale.to_s]
|
|
74
|
+
|
|
75
|
+
name = localized_name || default_name
|
|
76
|
+
|
|
77
|
+
[name,code]
|
|
78
|
+
end
|
|
79
|
+
sorted ? country_list.sort : country_list
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def html_safe_newline
|
|
84
|
+
"\n".html_safe
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
data/lib/country_select.rb
CHANGED
|
@@ -1,105 +1,12 @@
|
|
|
1
|
-
#
|
|
2
|
-
require 'country_select/version'
|
|
3
|
-
|
|
4
|
-
module ActionView
|
|
5
|
-
module Helpers
|
|
6
|
-
module FormOptionsHelper
|
|
7
|
-
# Return select and option tags for the given object and method, using country_options_for_select to generate the list of option tags.
|
|
8
|
-
def country_select(object, method, priority_countries = nil, options = {}, html_options = {})
|
|
9
|
-
# check if InstanceTag defined and accepts more than zero attributes in new method
|
|
10
|
-
if defined?(ActionView::Helpers::InstanceTag) && ActionView::Helpers::InstanceTag.instance_method(:initialize).arity != 0
|
|
11
|
-
InstanceTag.new(object, method, self, options.delete(:object)).to_country_select_tag(priority_countries, options, html_options)
|
|
12
|
-
else
|
|
13
|
-
CountrySelect.new(object, method, self, options).to_country_select_tag(priority_countries, options, html_options)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
# Returns a string of option tags for pretty much any country in the world. Supply a country name as +selected+ to
|
|
17
|
-
# have it marked as the selected option tag. You can also supply an array of countries as +priority_countries+, so
|
|
18
|
-
# that they will be listed above the rest of the (long) list.
|
|
19
|
-
#
|
|
20
|
-
# NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.
|
|
21
|
-
def country_options_for_select(selected = nil, priority_countries = nil)
|
|
22
|
-
country_options = "".html_safe
|
|
23
|
-
|
|
24
|
-
if priority_countries
|
|
25
|
-
country_options += options_for_select(priority_countries, selected)
|
|
26
|
-
country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n".html_safe
|
|
27
|
-
# prevents selected from being included twice in the HTML which causes
|
|
28
|
-
# some browsers to select the second selected option (not priority)
|
|
29
|
-
# which makes it harder to select an alternative priority country
|
|
30
|
-
selected=nil if priority_countries.include?(selected)
|
|
31
|
-
end
|
|
1
|
+
# encoding: utf-8
|
|
32
2
|
|
|
33
|
-
|
|
34
|
-
end
|
|
35
|
-
# All the countries included in the country_options output.
|
|
36
|
-
COUNTRIES = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola",
|
|
37
|
-
"Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria",
|
|
38
|
-
"Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin",
|
|
39
|
-
"Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil",
|
|
40
|
-
"British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia",
|
|
41
|
-
"Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
|
|
42
|
-
"Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo",
|
|
43
|
-
"Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba",
|
|
44
|
-
"Curacao", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt",
|
|
45
|
-
"El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)",
|
|
46
|
-
"Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia",
|
|
47
|
-
"French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea",
|
|
48
|
-
"Guinea-Bissau", "Guyana", "Haiti", "Heard and McDonald Islands", "Holy See (Vatican City State)",
|
|
49
|
-
"Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic of", "Iraq",
|
|
50
|
-
"Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya",
|
|
51
|
-
"Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan",
|
|
52
|
-
"Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya",
|
|
53
|
-
"Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, The Former Yugoslav Republic Of",
|
|
54
|
-
"Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique",
|
|
55
|
-
"Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of",
|
|
56
|
-
"Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru",
|
|
57
|
-
"Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Niger",
|
|
58
|
-
"Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau",
|
|
59
|
-
"Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines",
|
|
60
|
-
"Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation",
|
|
61
|
-
"Rwanda", "Saint Barthelemy", "Saint Helena", "Saint Kitts and Nevis", "Saint Lucia",
|
|
62
|
-
"Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino",
|
|
63
|
-
"Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore",
|
|
64
|
-
"Sint Maarten","Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa",
|
|
65
|
-
"South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "Sudan", "Suriname",
|
|
66
|
-
"Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic",
|
|
67
|
-
"Taiwan", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste",
|
|
68
|
-
"Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan",
|
|
69
|
-
"Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom",
|
|
70
|
-
"United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela",
|
|
71
|
-
"Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.", "Wallis and Futuna", "Western Sahara",
|
|
72
|
-
"Yemen", "Zambia", "Zimbabwe"] unless const_defined?("COUNTRIES")
|
|
73
|
-
end
|
|
3
|
+
require 'iso3166'
|
|
74
4
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
html_options = html_options.stringify_keys
|
|
78
|
-
add_default_name_and_id(html_options)
|
|
79
|
-
value = value(object)
|
|
80
|
-
content_tag("select",
|
|
81
|
-
add_options(
|
|
82
|
-
country_options_for_select(value, priority_countries),
|
|
83
|
-
options, value
|
|
84
|
-
), html_options
|
|
85
|
-
)
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
if defined?(ActionView::Helpers::InstanceTag) && ActionView::Helpers::InstanceTag.instance_method(:initialize).arity != 0
|
|
90
|
-
class InstanceTag
|
|
91
|
-
include ToCountrySelectTag
|
|
92
|
-
end
|
|
93
|
-
else
|
|
94
|
-
class CountrySelect < Tags::Base
|
|
95
|
-
include ToCountrySelectTag
|
|
96
|
-
end
|
|
97
|
-
end
|
|
5
|
+
require 'country_select/version'
|
|
6
|
+
require 'country_select/tag_helper'
|
|
98
7
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
end
|
|
104
|
-
end
|
|
8
|
+
if defined?(ActionView::Helpers::Tags::Base)
|
|
9
|
+
require 'country_select/country_select_helper'
|
|
10
|
+
else
|
|
11
|
+
require 'country_select/rails3/country_select_helper'
|
|
105
12
|
end
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
require 'action_view'
|
|
6
|
+
require 'country_select'
|
|
7
|
+
|
|
8
|
+
describe "CountrySelect" do
|
|
9
|
+
include ActionView::Helpers::TagHelper
|
|
10
|
+
include ActionView::Helpers::FormOptionsHelper
|
|
11
|
+
|
|
12
|
+
class Walrus
|
|
13
|
+
attr_accessor :country_code
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
let(:walrus) { Walrus.new }
|
|
17
|
+
let!(:template) { ActionView::Base.new }
|
|
18
|
+
|
|
19
|
+
let(:builder) do
|
|
20
|
+
if defined?(ActionView::Helpers::Tags::Base)
|
|
21
|
+
ActionView::Helpers::FormBuilder.new(:walrus, walrus, template, {})
|
|
22
|
+
else
|
|
23
|
+
ActionView::Helpers::FormBuilder.new(:walrus, walrus, template, {}, Proc.new { })
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
let(:select_tag) do
|
|
28
|
+
<<-EOS.chomp.strip
|
|
29
|
+
<select id="walrus_country_code" name="walrus[country_code]">
|
|
30
|
+
EOS
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "selects the value of country_code" do
|
|
34
|
+
tag = options_for_select([['United States of America', 'US']], 'US')
|
|
35
|
+
|
|
36
|
+
walrus.country_code = 'US'
|
|
37
|
+
t = builder.country_select(:country_code)
|
|
38
|
+
expect(t).to include(tag)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "uses the locale specified by I18n.locale" do
|
|
42
|
+
tag = options_for_select([['Estados Unidos', 'US']], 'US')
|
|
43
|
+
|
|
44
|
+
walrus.country_code = 'US'
|
|
45
|
+
original_locale = I18n.locale
|
|
46
|
+
begin
|
|
47
|
+
I18n.locale = :es
|
|
48
|
+
t = builder.country_select(:country_code)
|
|
49
|
+
expect(t).to include(tag)
|
|
50
|
+
ensure
|
|
51
|
+
I18n.locale = original_locale
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "accepts a locale option" do
|
|
56
|
+
tag = options_for_select([['États-Unis', 'US']], 'US')
|
|
57
|
+
|
|
58
|
+
walrus.country_code = 'US'
|
|
59
|
+
t = builder.country_select(:country_code, locale: :fr)
|
|
60
|
+
expect(t).to include(tag)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "accepts priority countries" do
|
|
64
|
+
tag = options_for_select(
|
|
65
|
+
[
|
|
66
|
+
['Latvia','LV'],
|
|
67
|
+
['United States of America','US'],
|
|
68
|
+
['Denmark', 'DK'],
|
|
69
|
+
['-'*15,'-'*15]
|
|
70
|
+
],
|
|
71
|
+
selected: 'US',
|
|
72
|
+
disabled: '-'*15
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
walrus.country_code = 'US'
|
|
76
|
+
t = builder.country_select(:country_code, priority_countries: ['LV','US','DK'])
|
|
77
|
+
expect(t).to include(tag)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "selects only the first matching option" do
|
|
81
|
+
tag = options_for_select([["United States of America", "US"],["Uruguay", "UY"]], "US")
|
|
82
|
+
walrus.country_code = 'US'
|
|
83
|
+
t = builder.country_select(:country_code, priority_countries: ['LV','US'])
|
|
84
|
+
expect(t).to_not include(tag)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it "displays only the chosen countries" do
|
|
88
|
+
options = [["Denmark", "DK"],["Germany", "DE"]]
|
|
89
|
+
tag = builder.select(:country_code, options)
|
|
90
|
+
walrus.country_code = 'US'
|
|
91
|
+
t = builder.country_select(:country_code, only: ['DK','DE'])
|
|
92
|
+
expect(t).to eql(tag)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
it "discards some countries" do
|
|
96
|
+
tag = options_for_select([["United States of America", "US"]])
|
|
97
|
+
walrus.country_code = 'DE'
|
|
98
|
+
t = builder.country_select(:country_code, except: ['US'])
|
|
99
|
+
expect(t).to_not include(tag)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
context "using old 1.x syntax" do
|
|
103
|
+
it "accepts priority countries" do
|
|
104
|
+
tag = options_for_select(
|
|
105
|
+
[
|
|
106
|
+
['Latvia','LV'],
|
|
107
|
+
['United States of America','US'],
|
|
108
|
+
['Denmark', 'DK'],
|
|
109
|
+
['-'*15,'-'*15]
|
|
110
|
+
],
|
|
111
|
+
selected: 'US',
|
|
112
|
+
disabled: '-'*15
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
walrus.country_code = 'US'
|
|
116
|
+
t = builder.country_select(:country_code, ['LV','US','DK'])
|
|
117
|
+
expect(t).to include(tag)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
it "selects only the first matching option" do
|
|
121
|
+
tag = options_for_select([["United States of America", "US"],["Uruguay", "UY"]], "US")
|
|
122
|
+
walrus.country_code = 'US'
|
|
123
|
+
t = builder.country_select(:country_code, ['LV','US'])
|
|
124
|
+
expect(t).to_not include(tag)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it "supports the country names as provided by default in Formtastic" do
|
|
128
|
+
tag = options_for_select([
|
|
129
|
+
["Australia", "AU"],
|
|
130
|
+
["Canada", "CA"],
|
|
131
|
+
["United Kingdom", "GB"],
|
|
132
|
+
["United States of America", "US"]
|
|
133
|
+
])
|
|
134
|
+
country_names = ["Australia", "Canada", "United Kingdom", "United States"]
|
|
135
|
+
t = builder.country_select(:country_code, country_names)
|
|
136
|
+
expect(t).to include(tag)
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
|
4
|
+
# loaded once.
|
|
5
|
+
#
|
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
7
|
+
|
|
8
|
+
require 'pry'
|
|
9
|
+
|
|
10
|
+
RSpec.configure do |config|
|
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
12
|
+
config.run_all_when_everything_filtered = true
|
|
13
|
+
config.filter_run :focus
|
|
14
|
+
|
|
15
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
16
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
17
|
+
# the seed, which is printed after each run.
|
|
18
|
+
# --seed 1234
|
|
19
|
+
config.order = 'random'
|
|
20
|
+
end
|
metadata
CHANGED
|
@@ -1,16 +1,97 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: country_select
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 2.0.0.rc1
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Stefan Penner
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
13
|
-
dependencies:
|
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rspec
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: actionpack
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '3'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '3'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: appraisal
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.0'
|
|
48
|
+
- - ">="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: 1.0.0
|
|
51
|
+
type: :development
|
|
52
|
+
prerelease: false
|
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - "~>"
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: '1.0'
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 1.0.0
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: pry
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: countries
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0.9'
|
|
82
|
+
- - ">="
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
version: 0.9.3
|
|
85
|
+
type: :runtime
|
|
86
|
+
prerelease: false
|
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
88
|
+
requirements:
|
|
89
|
+
- - "~>"
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: '0.9'
|
|
92
|
+
- - ">="
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: 0.9.3
|
|
14
95
|
description: Provides a simple helper to get an HTML select list of countries. The
|
|
15
96
|
list of countries comes from the ISO 3166 standard. While it is a relatively neutral
|
|
16
97
|
source of country names, it will still offend some users.
|
|
@@ -20,43 +101,53 @@ executables: []
|
|
|
20
101
|
extensions: []
|
|
21
102
|
extra_rdoc_files: []
|
|
22
103
|
files:
|
|
23
|
-
- .gitignore
|
|
104
|
+
- ".gitignore"
|
|
105
|
+
- ".rspec"
|
|
106
|
+
- ".travis.yml"
|
|
107
|
+
- Appraisals
|
|
108
|
+
- CHANGELOG.md
|
|
24
109
|
- Gemfile
|
|
25
110
|
- MIT-LICENSE
|
|
26
111
|
- README.md
|
|
27
112
|
- Rakefile
|
|
28
|
-
-
|
|
113
|
+
- UPGRADING.md
|
|
29
114
|
- country_select.gemspec
|
|
115
|
+
- gemfiles/actionpack3.0.gemfile
|
|
116
|
+
- gemfiles/actionpack3.1.gemfile
|
|
117
|
+
- gemfiles/actionpack3.2.gemfile
|
|
118
|
+
- gemfiles/actionpack4.0.gemfile
|
|
119
|
+
- gemfiles/actionpack4.1.gemfile
|
|
30
120
|
- lib/country_select.rb
|
|
121
|
+
- lib/country_select/country_select_helper.rb
|
|
122
|
+
- lib/country_select/rails3/country_select_helper.rb
|
|
123
|
+
- lib/country_select/tag_helper.rb
|
|
31
124
|
- lib/country_select/version.rb
|
|
32
|
-
|
|
33
|
-
|
|
125
|
+
- spec/country_select_spec.rb
|
|
126
|
+
- spec/spec_helper.rb
|
|
127
|
+
homepage: https://github.com/stefanpenner/country_select
|
|
128
|
+
licenses:
|
|
129
|
+
- MIT
|
|
130
|
+
metadata: {}
|
|
34
131
|
post_install_message:
|
|
35
132
|
rdoc_options: []
|
|
36
133
|
require_paths:
|
|
37
134
|
- lib
|
|
38
135
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
39
|
-
none: false
|
|
40
136
|
requirements:
|
|
41
|
-
- -
|
|
137
|
+
- - ">="
|
|
42
138
|
- !ruby/object:Gem::Version
|
|
43
139
|
version: '0'
|
|
44
|
-
segments:
|
|
45
|
-
- 0
|
|
46
|
-
hash: -229501016986175763
|
|
47
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
|
-
none: false
|
|
49
141
|
requirements:
|
|
50
|
-
- -
|
|
142
|
+
- - ">"
|
|
51
143
|
- !ruby/object:Gem::Version
|
|
52
|
-
version:
|
|
53
|
-
segments:
|
|
54
|
-
- 0
|
|
55
|
-
hash: -229501016986175763
|
|
144
|
+
version: 1.3.1
|
|
56
145
|
requirements: []
|
|
57
146
|
rubyforge_project: country_select
|
|
58
|
-
rubygems_version:
|
|
147
|
+
rubygems_version: 2.2.0
|
|
59
148
|
signing_key:
|
|
60
|
-
specification_version:
|
|
149
|
+
specification_version: 4
|
|
61
150
|
summary: Country Select Plugin
|
|
62
|
-
test_files:
|
|
151
|
+
test_files:
|
|
152
|
+
- spec/country_select_spec.rb
|
|
153
|
+
- spec/spec_helper.rb
|
data/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.1.0
|