country-select-code 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README.md +51 -0
- data/Rakefile +1 -0
- data/country-select-code.gemspec +22 -0
- data/lib/country-select-code.rb +164 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1ead20494016e5d7685a80fe4575551869ea9228
|
4
|
+
data.tar.gz: c970092d71734c50d9ced1039d19c804f315ca3f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a926d31bee98ee8d871c47240902ff80a02a22b95400dcee3908e59537f0624c2e58a3e9d38ee9580b98d1b81934749361b1481675d781b42897f9dc5e3a99c8
|
7
|
+
data.tar.gz: e7e88abcdf39e6e245cc838ec5062e12debb3f095ff2fe805a51638ad6104559a42a9821a547879d1a344590c7e54597d216e82ff343bcf550b10b383153a526
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 Michael Koziarski
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Country-Select-Code
|
2
|
+
|
3
|
+
Provides a simple helper to get an HTML select list of countries.
|
4
|
+
Optionally, you can store the country code instead of the full country name.
|
5
|
+
Compatible with Rails 4.
|
6
|
+
|
7
|
+
Code adapted from Rails' +country_select+ plugin (previously in core)
|
8
|
+
See https://github.com/jamesds/country-select
|
9
|
+
|
10
|
+
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.
|
11
|
+
Users are strongly advised to evaluate the suitability of this list given their user base.
|
12
|
+
|
13
|
+
## Latest Changes
|
14
|
+
|
15
|
+
**1.0.0**
|
16
|
+
|
17
|
+
- Initial version
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Install as a gem using
|
22
|
+
|
23
|
+
gem install country-select-code
|
24
|
+
|
25
|
+
Or put the following in your Gemfile
|
26
|
+
|
27
|
+
gem 'country-select-code'
|
28
|
+
|
29
|
+
## Example
|
30
|
+
|
31
|
+
Simple use supplying model and attribute as parameters:
|
32
|
+
|
33
|
+
country_select_code("user", "country_name")
|
34
|
+
|
35
|
+
Supplying priority countries to be placed at the top of the list:
|
36
|
+
|
37
|
+
country_select_code("user", "country_name", [ "United Kingdom", "France", "Germany" ])
|
38
|
+
|
39
|
+
Storing just the country code
|
40
|
+
|
41
|
+
country_select_code("user", "country_name", nil, :with_country_code => true)
|
42
|
+
|
43
|
+
Supplying priority countries with country code parameter
|
44
|
+
|
45
|
+
country_select_code("user", "country_name", [["United Kingdom", "GB"], ["France", "FR"], ["Germany", "DE"]], :with_country_code => true)
|
46
|
+
|
47
|
+
## Version History
|
48
|
+
|
49
|
+
- **1.0.0** - Initial version
|
50
|
+
|
51
|
+
Copyright (c) 2013 Andre Goncalves, released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "country-select-code"
|
7
|
+
spec.version = "1.0.0"
|
8
|
+
spec.authors = ["Andre Goncalves"]
|
9
|
+
spec.email = ["andre@questionform.com"]
|
10
|
+
spec.description = 'Provides a form helper to insert a country select box using the ISO 3166 country list, optionally stores just the country code. Compatible with rails 4'
|
11
|
+
spec.summary = 'Rails country code select helper'
|
12
|
+
spec.homepage = 'http://github.com/andregoncalves/country-select-code'
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
# = CountrySelectCode
|
2
|
+
#
|
3
|
+
# View helper for displaying select list with countries and country codes:
|
4
|
+
#
|
5
|
+
module ActionView
|
6
|
+
module Helpers
|
7
|
+
module FormOptionsHelper
|
8
|
+
# Return select and option tags for the given object and method, using country_options_for_select to generate the list of option tags.
|
9
|
+
def country_select_code(object, method, priority_countries = nil, options = {}, html_options = {})
|
10
|
+
|
11
|
+
if defined?(ActionView::Helpers::InstanceTag) && ActionView::Helpers::InstanceTag.instance_method(:initialize).arity != 0
|
12
|
+
tag = InstanceTag.new(object, method, self, options.delete(:object))
|
13
|
+
else
|
14
|
+
tag = CountrySelectCode.new(object, method, self, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
tag.to_country_select_code_tag(priority_countries, options, html_options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns a string of option tags for pretty much any country in the world. Supply a country name as +selected+ to
|
21
|
+
# have it marked as the selected option tag. You can also supply an array of countries as +priority_countries+, so
|
22
|
+
# that they will be listed above the rest of the (long) list.
|
23
|
+
#
|
24
|
+
# NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.
|
25
|
+
def country_options_for_select(selected = nil, priority_countries = nil, options = nil)
|
26
|
+
country_options = ""
|
27
|
+
|
28
|
+
countries = options[:with_country_code].nil? ? COUNTRIES : COUNTRIES_WITH_CODE
|
29
|
+
|
30
|
+
if priority_countries
|
31
|
+
if (unlisted = priority_countries - countries).any?
|
32
|
+
raise RuntimeError.new("Supplied priority countries are not in the main list: #{unlisted}")
|
33
|
+
end
|
34
|
+
country_options += options_for_select(priority_countries, selected)
|
35
|
+
country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
|
36
|
+
|
37
|
+
# prevents selected from being included twice in the HTML which causes
|
38
|
+
# some browsers to select the second selected option (not priority)
|
39
|
+
# which makes it harder to select an alternative priority country
|
40
|
+
selected = nil if priority_countries.include?(selected)
|
41
|
+
end
|
42
|
+
|
43
|
+
country_options = country_options.html_safe if country_options.respond_to?(:html_safe)
|
44
|
+
|
45
|
+
return country_options + options_for_select(countries, selected)
|
46
|
+
end
|
47
|
+
|
48
|
+
# All the countries included in the country_options output.
|
49
|
+
COUNTRIES = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola",
|
50
|
+
"Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria",
|
51
|
+
"Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin",
|
52
|
+
"Bermuda", "Bhutan", "Bolivia, Plurinational State of", "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina",
|
53
|
+
"Botswana", "Bouvet Island", "Brazil",
|
54
|
+
"British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia",
|
55
|
+
"Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
|
56
|
+
"Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo",
|
57
|
+
"Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba",
|
58
|
+
"Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt",
|
59
|
+
"El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)",
|
60
|
+
"Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia",
|
61
|
+
"French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece",
|
62
|
+
"Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea",
|
63
|
+
"Guinea-Bissau", "Guyana", "Haiti", "Heard Island and McDonald Islands", "Holy See (Vatican City State)",
|
64
|
+
"Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic of", "Iraq",
|
65
|
+
"Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya",
|
66
|
+
"Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan",
|
67
|
+
"Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya",
|
68
|
+
"Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, The Former Yugoslav Republic Of",
|
69
|
+
"Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique",
|
70
|
+
"Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of",
|
71
|
+
"Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru",
|
72
|
+
"Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Niger",
|
73
|
+
"Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau",
|
74
|
+
"Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines",
|
75
|
+
"Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation",
|
76
|
+
"Rwanda", "Saint Barthelemy", "Saint Helena, Ascension and Tristan da Cunha", "Saint Kitts and Nevis", "Saint Lucia",
|
77
|
+
"Saint Martin (French Part)", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino",
|
78
|
+
"Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore",
|
79
|
+
"Sint Maarten (Dutch Part)", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa",
|
80
|
+
"South Georgia and the South Sandwich Islands", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname",
|
81
|
+
"Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic",
|
82
|
+
"Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste",
|
83
|
+
"Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan",
|
84
|
+
"Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom",
|
85
|
+
"United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu",
|
86
|
+
"Venezuela, Bolivarian Republic of", "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.",
|
87
|
+
"Wallis and Futuna", "Western Sahara", "Yemen", "Zambia", "Zimbabwe"] unless const_defined?("COUNTRIES")
|
88
|
+
|
89
|
+
# All the countries included in the country_options output with the code.
|
90
|
+
COUNTRIES_WITH_CODE = [["Afghanistan", "AF"], ["Albania", "AL"], ["Algeria", "DZ"], ["American Samoa", "AS"], ["Andorra", "AD"], ["Angola", "AO"],
|
91
|
+
["Anguilla", "AI"], ["Antarctica", "AQ"], ["Antigua and Barbuda", "AG"], ["Argentina", "AR"], ["Armenia", "AM"], ["Aruba", "AW"],
|
92
|
+
["Australia", "AU"], ["Austria", "AT"], ["Azerbaidjan", "AZ"], ["Bahamas", "BS"], ["Bahrain", "BH"], ["Bangladesh", "BD"], ["Barbados", "BB"],
|
93
|
+
["Belarus", "BY"], ["Belgium", "BE"], ["Belize", "BZ"], ["Benin", "BJ"], ["Bermuda", "BM"], ["Bolivia", "BO"], ["Bosnia-Herzegovina", "BA"],
|
94
|
+
["Botswana", "BW"], ["Bouvet Island", "BV"], ["Brazil", "BR"], ["British Indian O. Terr.", "IO"], ["Brunei Darussalam", "BN"], ["Bulgaria", "BG"],
|
95
|
+
["Burkina Faso", "BF"], ["Burundi", "BI"], ["Buthan", "BT"], ["Cambodia", "KH"], ["Cameroon", "CM"], ["Canada", "CA"], ["Cape Verde", "CV"],
|
96
|
+
["Cayman Islands", "KY"], ["Central African Rep.", "CF"], ["Chad", "TD"], ["Chile", "CL"], ["China", "CN"], ["Christmas Island", "CX"],
|
97
|
+
["Cocos (Keeling) Isl.", "CC"], ["Colombia", "CO"], ["Comoros", "KM"], ["Congo", "CG"], ["Cook Islands", "CK"], ["Costa Rica", "CR"],
|
98
|
+
["Croatia", "HR"], ["Cuba", "CU"], ["Cyprus", "CY"], ["Czech Republic", "CZ"], ["Czechoslovakia", "CS"], ["Denmark", "DK"], ["Djibouti", "DJ"],
|
99
|
+
["Dominica", "DM"], ["Dominican Republic", "DO"], ["East Timor", "TP"], ["Ecuador", "EC"], ["Egypt", "EG"], ["El Salvador", "SV"],
|
100
|
+
["Equatorial Guinea", "GQ"], ["Estonia", "EE"], ["Ethiopia", "ET"], ["Falkland Isl.(UK)", "FK"], ["Faroe Islands", "FO"], ["Fiji", "FJ"],
|
101
|
+
["Finland", "FI"], ["France", "FR"], ["France (European Ter.)", "FX"], ["French Southern Terr.", "TF"], ["Gabon", "GA"], ["Gambia", "GM"],
|
102
|
+
["Georgia", "GE"], ["Germany", "DE"], ["Ghana", "GH"], ["Gibraltar", "GI"], ["Great Britain (UK)", "GB"], ["Greece", "GR"], ["Greenland", "GL"],
|
103
|
+
["Grenada", "GD"], ["Guadeloupe (Fr.)", "GP"], ["Guam (US)", "GU"], ["Guatemala", "GT"], ["Guinea", "GN"], ["Guinea Bissau", "GW"],
|
104
|
+
["Guyana", "GY"], ["Guyana (Fr.)", "GF"], ["Haiti", "HT"], ["Heard & McDonald Isl.", "HM"], ["Honduras", "HN"], ["Hong Kong", "HK"],
|
105
|
+
["Hungary", "HU"], ["Iceland", "IS"], ["India", "IN"], ["Indonesia", "ID"], ["Iran", "IR"], ["Iraq", "IQ"], ["Ireland", "IE"], ["Israel", "IL"],
|
106
|
+
["Italy", "IT"], ["Ivory Coast", "CI"], ["Jamaica", "JM"], ["Japan", "JP"], ["Jordan", "JO"], ["Kazachstan", "KZ"], ["Kenya", "KE"],
|
107
|
+
["Kirgistan", "KG"], ["Kiribati", "KI"], ["Korea (North)", "KP"], ["Korea (South)", "KR"], ["Kuwait", "KW"], ["Laos", "LA"], ["Latvia", "LV"],
|
108
|
+
["Lebanon", "LB"], ["Lesotho", "LS"], ["Liberia", "LR"], ["Libya", "LY"], ["Liechtenstein", "LI"], ["Lithuania", "LT"], ["Luxembourg", "LU"],
|
109
|
+
["Macau", "MO"], ["Madagascar", "MG"], ["Malawi", "MW"], ["Malaysia", "MY"], ["Maldives", "MV"], ["Mali", "ML"], ["Malta", "MT"],
|
110
|
+
["Marshall Islands", "MH"], ["Martinique (Fr.)", "MQ"], ["Mauritania", "MR"], ["Mauritius", "MU"], ["Mexico", "MX"], ["Micronesia", "FM"],
|
111
|
+
["Moldavia", "MD"], ["Monaco", "MC"], ["Mongolia", "MN"], ["Montserrat", "MS"], ["Morocco", "MA"], ["Mozambique", "MZ"], ["Myanmar", "MM"],
|
112
|
+
["Namibia", "NA"], ["Nauru", "NR"], ["Nepal", "NP"], ["Netherland Antilles", "AN"], ["Netherlands", "NL"], ["Neutral Zone", "NT"],
|
113
|
+
["New Caledonia (Fr.)", "NC"], ["New Zealand", "NZ"], ["Nicaragua", "NI"], ["Niger", "NE"], ["Nigeria", "NG"], ["Niue", "NU"],
|
114
|
+
["Norfolk Island", "NF"], ["Northern Mariana Isl.", "MP"], ["Norway", "NO"], ["Oman", "OM"], ["Pakistan", "PK"], ["Palau", "PW"],
|
115
|
+
["Panama", "PA"], ["Papua New", "PG"], ["Paraguay", "PY"], ["Peru", "PE"], ["Philippines", "PH"], ["Pitcairn", "PN"], ["Poland", "PL"],
|
116
|
+
["Polynesia (Fr.)", "PF"], ["Portugal", "PT"], ["Puerto Rico (US)", "PR"], ["Qatar", "QA"], ["Reunion (Fr.)", "RE"], ["Romania", "RO"],
|
117
|
+
["Russian Federation", "RU"], ["Rwanda", "RW"], ["Saint Lucia", "LC"], ["Samoa", "WS"], ["San Marino", "SM"], ["Saudi Arabia", "SA"],
|
118
|
+
["Senegal", "SN"], ["Seychelles", "SC"], ["Sierra Leone", "SL"], ["Singapore", "SG"], ["Slovak Republic", "SK"], ["Slovenia", "SI"],
|
119
|
+
["Solomon Islands", "SB"], ["Somalia", "SO"], ["South Africa", "ZA"], ["Spain", "ES"], ["Sri Lanka", "LK"],
|
120
|
+
["St. Helena", "SH"], ["St. Pierre & Miquelon", "PM"], ["St. Tome and Principe", "ST"], ["St.Kitts Nevis Anguilla", "KN"],
|
121
|
+
["St.Vincent & Grenadines", "VC"], ["Sudan", "SD"], ["Suriname", "SR"], ["Svalbard & Jan Mayen Is", "SJ"], ["Swaziland", "SZ"], ["Sweden", "SE"],
|
122
|
+
["Switzerland", "CH"], ["Syria", "SY"], ["Tadjikistan", "TJ"], ["Taiwan", "TW"], ["Tanzania", "TZ"], ["Thailand", "TH"], ["Togo", "TG"],
|
123
|
+
["Tokelau", "TK"], ["Tonga", "TO"], ["Trinidad & Tobago", "TT"], ["Tunisia", "TN"], ["Turkey", "TR"], ["Turkmenistan", "TM"],
|
124
|
+
["Turks & Caicos Islands", "TC"], ["Tuvalu", "TV"], ["Uganda", "UG"], ["Ukraine", "UA"], ["United Arab Emirates", "AE"], ["United Kingdom", "GB"],
|
125
|
+
["United States", "US"], ["Uruguay", "UY"], ["US Minor outlying Isl.", "UM"], ["Uzbekistan", "UZ"], ["Vanuatu", "VU"], ["Vatican City State", "VA"],
|
126
|
+
["Venezuela", "VE"], ["Vietnam", "VN"], ["Virgin Islands (British)", "VG"], ["Virgin Islands (US)", "VI"], ["Wallis & Futuna Islands", "WF"],
|
127
|
+
["Western Sahara", "EH"], ["Yemen", "YE"], ["Yugoslavia", "YU"], ["Zaire", "ZR"], ["Zambia", "ZM"], ["Zimbabwe", "ZW"]] unless const_defined?("COUNTRIES_WITH_CODE")
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
module ToCountrySelectCodeTag
|
133
|
+
def to_country_select_code_tag(priority_countries, options, html_options)
|
134
|
+
html_options = html_options.stringify_keys
|
135
|
+
add_default_name_and_id(html_options)
|
136
|
+
value = value(object)
|
137
|
+
content_tag("select",
|
138
|
+
add_options(
|
139
|
+
country_options_for_select(value, priority_countries, options),
|
140
|
+
options, value
|
141
|
+
), html_options
|
142
|
+
)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
# Rails 4 compatibility code
|
147
|
+
if defined?(ActionView::Helpers::InstanceTag) && ActionView::Helpers::InstanceTag.instance_method(:initialize).arity != 0
|
148
|
+
class InstanceTag
|
149
|
+
include ToCountrySelectCodeTag
|
150
|
+
end
|
151
|
+
else
|
152
|
+
class CountrySelectCode < Tags::Base
|
153
|
+
include ToCountrySelectCodeTag
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
class FormBuilder
|
159
|
+
def country_select_code(method, priority_countries = nil, options = {}, html_options = {})
|
160
|
+
@template.country_select_code(@object_name, method, priority_countries, options.merge(:object => @object), html_options)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: country-select-code
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andre Goncalves
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Provides a form helper to insert a country select box using the ISO 3166
|
42
|
+
country list, optionally stores just the country code. Compatible with rails 4
|
43
|
+
email:
|
44
|
+
- andre@questionform.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- MIT-LICENSE
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- country-select-code.gemspec
|
55
|
+
- lib/country-select-code.rb
|
56
|
+
homepage: http://github.com/andregoncalves/country-select-code
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.0.3
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Rails country code select helper
|
80
|
+
test_files: []
|