country-select 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -9
- data/lib/country-select.rb +6 -4
- metadata +2 -2
data/README.md
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
# Country-Select
|
2
2
|
|
3
|
-
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
|
3
|
+
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 may still offend some users.
|
4
4
|
|
5
5
|
Users are strongly advised to evaluate the suitability of this list given their user base.
|
6
6
|
|
7
7
|
## Latest Changes
|
8
8
|
|
9
|
+
**1.1.1**
|
10
|
+
|
11
|
+
- Fixed incompatibility with Rails 3.2.2 (thanks to [jmazzi](https://github.com/jamesds/country-select/pull/4))
|
12
|
+
|
9
13
|
**1.1.0**
|
10
14
|
|
11
15
|
- Updated the country list to change the name of *Libyan Arab Jamahiriya* to *Libya* according to the [latest ISO 3166 newsletter](http://www.iso.org/iso/nl_vi-11_name_change_for_libya.pdf)
|
@@ -34,14 +38,7 @@ Supplying priority countries to be placed at the top of the list:
|
|
34
38
|
|
35
39
|
## Version History
|
36
40
|
|
37
|
-
**1.0.5**
|
38
|
-
|
39
|
-
- Runtime error raised if any of the user-supplied priority countries do not correlate with those in the main country list.
|
40
|
-
|
41
|
-
**Note:** this may cause existing applications using country-select to fail, but such failures will highlight incorrect usage, enabling the implementation to be corrected so that correct and accurate data may be gathered.
|
42
|
-
|
43
|
-
Thanks to Steve Purcell (http://github.com/purcell) for this addition.
|
44
|
-
|
41
|
+
- **1.0.5** - runtime error raised if any of the user-supplied priority countries do not correlate with those in the main country list.
|
45
42
|
- **1.0.4** - updated the country list to match the latest ISO 3166 specification
|
46
43
|
- **1.0.3** - changed gem name from 'iso-3166-country-select' to just 'country-select'
|
47
44
|
- **1.0.2** - forked the plugin and made it into a gem
|
data/lib/country-select.rb
CHANGED
@@ -20,13 +20,15 @@ module ActionView
|
|
20
20
|
end
|
21
21
|
country_options += options_for_select(priority_countries, selected)
|
22
22
|
country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
|
23
|
-
|
23
|
+
|
24
24
|
# prevents selected from being included twice in the HTML which causes
|
25
25
|
# some browsers to select the second selected option (not priority)
|
26
26
|
# which makes it harder to select an alternative priority country
|
27
27
|
selected = nil if priority_countries.include?(selected)
|
28
28
|
end
|
29
29
|
|
30
|
+
country_options = country_options.html_safe if country_options.respond_to?(:html_safe)
|
31
|
+
|
30
32
|
return country_options + options_for_select(COUNTRIES, selected)
|
31
33
|
end
|
32
34
|
|
@@ -34,7 +36,7 @@ module ActionView
|
|
34
36
|
COUNTRIES = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola",
|
35
37
|
"Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria",
|
36
38
|
"Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin",
|
37
|
-
"Bermuda", "Bhutan", "Bolivia, Plurinational State of", "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina",
|
39
|
+
"Bermuda", "Bhutan", "Bolivia, Plurinational State of", "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina",
|
38
40
|
"Botswana", "Bouvet Island", "Brazil",
|
39
41
|
"British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia",
|
40
42
|
"Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
|
@@ -71,7 +73,7 @@ module ActionView
|
|
71
73
|
"Venezuela, Bolivarian Republic of", "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.",
|
72
74
|
"Wallis and Futuna", "Western Sahara", "Yemen", "Zambia", "Zimbabwe"] unless const_defined?("COUNTRIES")
|
73
75
|
end
|
74
|
-
|
76
|
+
|
75
77
|
class InstanceTag
|
76
78
|
def to_country_select_tag(priority_countries, options, html_options)
|
77
79
|
html_options = html_options.stringify_keys
|
@@ -85,7 +87,7 @@ module ActionView
|
|
85
87
|
)
|
86
88
|
end
|
87
89
|
end
|
88
|
-
|
90
|
+
|
89
91
|
class FormBuilder
|
90
92
|
def country_select(method, priority_countries = nil, options = {}, html_options = {})
|
91
93
|
@template.country_select(@object_name, method, priority_countries, options.merge(:object => @object), html_options)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: country-select
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-03-02 00:00:00.000000000 +00:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
description: Provides a form helper to insert a country select box using the ISO 3166
|