country_state_select 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.gitignore +1 -0
- data/README.md +23 -3
- data/country_state_select.gemspec +6 -4
- data/lib/country_state_select.rb +21 -504
- data/lib/country_state_select/constant.rb +145 -0
- data/lib/country_state_select/engine.rb +8 -0
- data/lib/country_state_select/engine3.rb +8 -0
- data/lib/country_state_select/railtie.rb +8 -0
- data/lib/country_state_select/version.rb +1 -1
- data/test/dummy/.gitignore +16 -0
- data/test/dummy/Gemfile +47 -0
- data/test/dummy/README.rdoc +3 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +17 -0
- data/test/dummy/app/assets/javascripts/users.js.coffee +3 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/scaffolds.css.scss +69 -0
- data/test/dummy/app/assets/stylesheets/users.css.scss +3 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/controllers/users_controller.rb +74 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/users_helper.rb +2 -0
- data/test/dummy/app/mailers/.keep +0 -0
- data/test/dummy/app/models/.keep +0 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/models/user.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/users/_form.html.erb +36 -0
- data/test/dummy/app/views/users/edit.html.erb +6 -0
- data/test/dummy/app/views/users/index.html.erb +35 -0
- data/test/dummy/app/views/users/index.json.jbuilder +4 -0
- data/test/dummy/app/views/users/new.html.erb +5 -0
- data/test/dummy/app/views/users/show.html.erb +27 -0
- data/test/dummy/app/views/users/show.json.jbuilder +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +4 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/db/migrate/20140724080030_create_users.rb +12 -0
- data/test/dummy/db/migrate/20140728194622_add_state_name_to_users.rb +5 -0
- data/test/dummy/db/migrate/20140728203606_add_country_name_to_user.rb +5 -0
- data/test/dummy/db/schema.rb +27 -0
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/lib/tasks/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/robots.txt +5 -0
- data/test/dummy/test/controllers/.keep +0 -0
- data/test/dummy/test/controllers/users_controller_test.rb +49 -0
- data/test/dummy/test/fixtures/.keep +0 -0
- data/test/dummy/test/fixtures/users.yml +13 -0
- data/test/dummy/test/helpers/.keep +0 -0
- data/test/dummy/test/helpers/users_helper_test.rb +4 -0
- data/test/dummy/test/integration/.keep +0 -0
- data/test/dummy/test/mailers/.keep +0 -0
- data/test/dummy/test/models/.keep +0 -0
- data/test/dummy/test/models/user_test.rb +7 -0
- data/test/dummy/test/test_helper.rb +15 -0
- data/test/dummy/vendor/assets/javascripts/.keep +0 -0
- data/test/dummy/vendor/assets/stylesheets/.keep +0 -0
- data/vendor/assets/javascript/country_state_select.js.erb +43 -0
- metadata +101 -9
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NGNhZWIyOTQzM2VhYjc2YWRjODQxZmVlMzdiMDVlNTc1MGU0M2I5OA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OGQxMWVjY2VhZDQzZjc2MTg4OGRjYWE1NDY3NDBkYTRjMWNhN2E3OQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZjU2NWUyYTczNWY1ZjFhYzgwNjcxZTc0YjVkNmU0MDBmMzYxOGZkN2U4ZGVj
|
10
|
+
OTYzNWU0NzIxZWY3ZGQwMjRmNmI1NDY1MGYyZWE0ZjFhMTNmMDQ1YzFmYzUz
|
11
|
+
NTU2OTQxMjY2NjEzNmFlYzNjMGU4MGVjOTE2Y2JjNjA4NjY5YmI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NGJjMWJhYTg5ZGY0ZmI3MWIyY2VhMjcyOTgzYzgzNzA5ZjE4YmE2YmVkZjA2
|
14
|
+
MjQ3NGZlMDNhNTZkMDk3MzRmYjE3NWEwMjZhODNmZjAxOTM0NDk3MWU0NTU2
|
15
|
+
ODE1OGQ1YThhNTQzMGMwOWM1NGZhZmY5ZmRmZDYyMjBmZTBhNTM=
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -16,6 +16,29 @@ Or install it yourself as:
|
|
16
16
|
$ gem install country_state_select
|
17
17
|
|
18
18
|
|
19
|
+
##Very easy to create select box just follow below steps
|
20
|
+
|
21
|
+
It will create for you a select option, just care about 'id' if you want to update your state field
|
22
|
+
|
23
|
+
<%= f.select :country_name, CountryStateSelect::Constant::COUNTRIES, {}, id: 'country_id' %>
|
24
|
+
|
25
|
+
Create your state like mention below, and take care about id of the select field if you will change this then it will now work as it should be
|
26
|
+
|
27
|
+
<%= f.text_field :state_name ,:id=> 'state_name'%>
|
28
|
+
|
29
|
+
If you want to store country id then use this select option it will store the country id inside the database if you want the state field update with this then you can put id field inside this also like we have mention in previous example
|
30
|
+
|
31
|
+
<%= f.select(:country_id, options_for_select(Array[*CountryStateSelect::Constant::COUNTRIES.collect {|v,i| [v,
|
32
|
+
CountryStateSelect::Constant::COUNTRIES.index(v)] }], :selected => f.object)) %>
|
33
|
+
|
34
|
+
If you want to fetch the country name By 'id' then you have to just write
|
35
|
+
|
36
|
+
<%= CountryStateSelect::Constant::COUNTRIES['PASS THE COUNTRY ID WHICH YOU SAVE HERE'] %>
|
37
|
+
|
38
|
+
|
39
|
+
NOTE :- It will update the state field when there will be India,United Kingdom,Canada and United States so except there country if you select other country then you have to manually enter the state name, we are working on this soon we will cover most of the country
|
40
|
+
|
41
|
+
|
19
42
|
## Contributing
|
20
43
|
|
21
44
|
1. Fork it ( https://github.com/[my-github-username]/country_state_select/fork )
|
@@ -23,6 +46,3 @@ Or install it yourself as:
|
|
23
46
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
24
47
|
4. Push to the branch (`git push origin my-new-feature`)
|
25
48
|
5. Create a new Pull Request
|
26
|
-
|
27
|
-
|
28
|
-
##Currently I m working on this, state will add soon on this also refector the code and need to add the test case
|
@@ -13,10 +13,12 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "https://github.com/arvindvyas/country_state_select.git"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
-
spec.
|
17
|
-
spec.
|
18
|
-
spec.test_files =
|
19
|
-
spec.require_paths = [
|
16
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
spec.files = `git ls-files`.split("\n")
|
18
|
+
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'rails', '>= 3.0'
|
20
22
|
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.6"
|
22
24
|
spec.add_development_dependency "rake"
|
data/lib/country_state_select.rb
CHANGED
@@ -1,514 +1,16 @@
|
|
1
1
|
require "country_state_select/version"
|
2
2
|
|
3
|
-
|
4
|
-
#added all the countries
|
5
|
-
COUNTRIES = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola",
|
6
|
-
"Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria",
|
7
|
-
"Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin",
|
8
|
-
"Bermuda", "Bhutan", "Bolivia, Plurinational State of", "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina",
|
9
|
-
"Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia",
|
10
|
-
"Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
|
11
|
-
"Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba",
|
12
|
-
"Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt","El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece",
|
13
|
-
"Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard Island and McDonald Islands", "Holy See (Vatican City State)",
|
14
|
-
"Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic of", "Iraq",
|
15
|
-
"Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya",
|
16
|
-
"Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan",
|
17
|
-
"Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya",
|
18
|
-
"Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, The Former Yugoslav Republic Of",
|
19
|
-
"Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique",
|
20
|
-
"Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of",
|
21
|
-
"Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru",
|
22
|
-
"Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau",
|
23
|
-
"Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines",
|
24
|
-
"Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation",
|
25
|
-
"Rwanda", "Saint Barthelemy", "Saint Helena, Ascension and Tristan da Cunha", "Saint Kitts and Nevis", "Saint Lucia",
|
26
|
-
"Saint Martin (French Part)", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino",
|
27
|
-
"Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore",
|
28
|
-
"Sint Maarten (Dutch Part)", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa",
|
29
|
-
"South Georgia and the South Sandwich Islands", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname",
|
30
|
-
"Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic",
|
31
|
-
"Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste",
|
32
|
-
"Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan",
|
33
|
-
"Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom",
|
34
|
-
"United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu",
|
35
|
-
"Venezuela, Bolivarian Republic of", "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.",
|
36
|
-
"Wallis and Futuna", "Western Sahara", "Yemen", "Zambia", "Zimbabwe"]
|
37
|
-
|
38
|
-
INDIAN_STATES = [
|
39
|
-
'AP' => 'Andhra Pradesh',
|
40
|
-
'AR' => 'Arunachal Pradesh',
|
41
|
-
'AS' => 'Assam',
|
42
|
-
'BR' => 'Bihar',
|
43
|
-
'CT' => 'Chhattisgarh',
|
44
|
-
'GA' => 'Goa',
|
45
|
-
'GJ' => 'Gujarat',
|
46
|
-
'HR' => 'Haryana',
|
47
|
-
'HP' => 'Himachal Pradesh',
|
48
|
-
'JK' => 'Jammu & Kashmir',
|
49
|
-
'JH' => 'Jharkhand',
|
50
|
-
'KA' => 'Karnataka',
|
51
|
-
'KL' => 'Kerala',
|
52
|
-
'MP' => 'Madhya Pradesh',
|
53
|
-
'MH' => 'Maharashtra',
|
54
|
-
'MN' => 'Manipur',
|
55
|
-
'ML' => 'Meghalaya',
|
56
|
-
'MZ' => 'Mizoram',
|
57
|
-
'NL' => 'Nagaland',
|
58
|
-
'OR' => 'Odisha',
|
59
|
-
'PB' => 'Punjab',
|
60
|
-
'RJ' => 'Rajasthan',
|
61
|
-
'SK' => 'Sikkim',
|
62
|
-
'TN' => 'Tamil Nadu',
|
63
|
-
'TR' => 'Tripura',
|
64
|
-
'UK' => 'Uttarakhand',
|
65
|
-
'UP' => 'Uttar Pradesh',
|
66
|
-
'WB' => 'West Bengal',
|
67
|
-
]
|
68
|
-
INDIAN_TERRIOTORY = [
|
69
|
-
'AN' => 'Andaman & Nicobar',
|
70
|
-
'CH' => 'Chandigarh',
|
71
|
-
'DN' => 'Dadra and Nagar Haveli',
|
72
|
-
'DD' => 'Daman & Diu',
|
73
|
-
'DL' => 'Delhi',
|
74
|
-
'LD' => 'Lakshadweep',
|
75
|
-
'PY' => 'Puducherry',
|
76
|
-
]
|
77
|
-
|
78
|
-
USA_STATE_LIST = [
|
79
|
-
'AL'=>"Alabama",
|
80
|
-
'AK'=>"Alaska",
|
81
|
-
'AZ'=>"Arizona",
|
82
|
-
'AR'=>"Arkansas",
|
83
|
-
'CA'=>"California",
|
84
|
-
'CO'=>"Colorado",
|
85
|
-
'CT'=>"Connecticut",
|
86
|
-
'DE'=>"Delaware",
|
87
|
-
'DC'=>"District Of Columbia",
|
88
|
-
'FL'=>"Florida",
|
89
|
-
'GA'=>"Georgia",
|
90
|
-
'HI'=>"Hawaii",
|
91
|
-
'ID'=>"Idaho",
|
92
|
-
'IL'=>"Illinois",
|
93
|
-
'IN'=>"Indiana",
|
94
|
-
'IA'=>"Iowa",
|
95
|
-
'KS'=>"Kansas",
|
96
|
-
'KY'=>"Kentucky",
|
97
|
-
'LA'=>"Louisiana",
|
98
|
-
'ME'=>"Maine",
|
99
|
-
'MD'=>"Maryland",
|
100
|
-
'MA'=>"Massachusetts",
|
101
|
-
'MI'=>"Michigan",
|
102
|
-
'MN'=>"Minnesota",
|
103
|
-
'MS'=>"Mississippi",
|
104
|
-
'MO'=>"Missouri",
|
105
|
-
'MT'=>"Montana",
|
106
|
-
'NE'=>"Nebraska",
|
107
|
-
'NV'=>"Nevada",
|
108
|
-
'NH'=>"New Hampshire",
|
109
|
-
'NJ'=>"New Jersey",
|
110
|
-
'NM'=>"New Mexico",
|
111
|
-
'NY'=>"New York",
|
112
|
-
'NC'=>"North Carolina",
|
113
|
-
'ND'=>"North Dakota",
|
114
|
-
'OH'=>"Ohio",
|
115
|
-
'OK'=>"Oklahoma",
|
116
|
-
'OR'=>"Oregon",
|
117
|
-
'PA'=>"Pennsylvania",
|
118
|
-
'RI'=>"Rhode Island",
|
119
|
-
'SC'=>"South Carolina",
|
120
|
-
'SD'=>"South Dakota",
|
121
|
-
'TN'=>"Tennessee",
|
122
|
-
'TX'=>"Texas",
|
123
|
-
'UT'=>"Utah",
|
124
|
-
'VT'=>"Vermont",
|
125
|
-
'VA'=>"Virginia",
|
126
|
-
'WA'=>"Washington",
|
127
|
-
'WV'=>"West Virginia",
|
128
|
-
'WI'=>"Wisconsin",
|
129
|
-
'WY'=>"Wyoming"
|
130
|
-
]
|
131
|
-
|
132
|
-
CANADIAN_STATES = [
|
133
|
-
"BC" => "British Columbia",
|
134
|
-
"ON" => "Ontario",
|
135
|
-
"NL" => "Newfoundland and Labrador",
|
136
|
-
"NS" => "Nova Scotia",
|
137
|
-
"PE" => "Prince Edward Island",
|
138
|
-
"NB" => "New Brunswick",
|
139
|
-
"QC" => "Quebec",
|
140
|
-
"MB" => "Manitoba",
|
141
|
-
"SK" => "Saskatchewan",
|
142
|
-
"AB" => "Alberta",
|
143
|
-
"NT" => "Northwest Territories",
|
144
|
-
"NU" => "Nunavut",
|
145
|
-
"YT" => "Yukon Territory"
|
146
|
-
]
|
3
|
+
require 'country_state_select/constant'
|
147
4
|
|
5
|
+
module CountryStateSelect
|
6
|
+
include CountryStateSelect::Constant
|
148
7
|
|
149
|
-
UK_STATES = [
|
150
|
-
'GSY' => "Guernsey",
|
151
|
-
'JSY' => "Jersey",
|
152
|
-
'BDG' => "Barking and Dagenham",
|
153
|
-
'BNE' => "Barnet",
|
154
|
-
'BNS' => "Barnsley",
|
155
|
-
'BAS' => "Bath and North East Somerset",
|
156
|
-
'BDF' => "Bedfordshire",
|
157
|
-
'BEX' => "Bexley",
|
158
|
-
'BIR' => "Birmingham",
|
159
|
-
'BBD' => "Blackburn with Darwen",
|
160
|
-
'BPL' => "Blackpool",
|
161
|
-
'BOL' => "Bolton",
|
162
|
-
'BMH' => "Bournemouth",
|
163
|
-
'BRC' => "Bracknell Forest",
|
164
|
-
'BRD' => "Bradford",
|
165
|
-
'BEN' => "Brent",
|
166
|
-
'BNH' => "Brighton and Hove",
|
167
|
-
'BST' => "Bristol City of",
|
168
|
-
'BRY' => "Bromley",
|
169
|
-
'BKM' => "Buckinghamshire",
|
170
|
-
'BUR' => "Bury",
|
171
|
-
'CLD' => "Calderdale",
|
172
|
-
'CAM' => "Cambridgeshire",
|
173
|
-
'CMD' => "Camden",
|
174
|
-
'CHS' => "Cheshire",
|
175
|
-
'CON' => "Cornwall",
|
176
|
-
'COV' => "Coventry (West Midlands district)",
|
177
|
-
'CRY' => "Croydon",
|
178
|
-
'CMA' => "Cumbria",
|
179
|
-
'DAL' => "Darlington",
|
180
|
-
'DER' => "Derby",
|
181
|
-
'DBY' => "Derbyshire",
|
182
|
-
'DEV' => "Devon",
|
183
|
-
'DNC' => "Doncaster",
|
184
|
-
'DOR' => "Dorset",
|
185
|
-
'DUD' => "Dudley (West Midlands district)",
|
186
|
-
'DUR' => "Durham",
|
187
|
-
'EAL' => "Ealing",
|
188
|
-
'ERY' => "East Riding of Yorkshire",
|
189
|
-
'ESX' => "East Sussex",
|
190
|
-
'ENF' => "Enfield",
|
191
|
-
'ESS' => "Essex",
|
192
|
-
'GAT' => "Gateshead (Tyne & Wear district)",
|
193
|
-
'GLS' => "Gloucestershire",
|
194
|
-
'GRE' => "Greenwich",
|
195
|
-
'HCK' => "Hackney",
|
196
|
-
'HAL' => "Halton",
|
197
|
-
'HMF' => "Hammersmith and Fulham",
|
198
|
-
'HAM' => "Hampshire",
|
199
|
-
'HRY' => "Haringey",
|
200
|
-
'HRW' => "Harrow",
|
201
|
-
'HPL' => "Hartlepool",
|
202
|
-
'HAV' => "Havering",
|
203
|
-
'HEF' => "Herefordshire County of",
|
204
|
-
'HRT' => "Hertfordshire",
|
205
|
-
'HIL' => "Hillingdon",
|
206
|
-
'HNS' => "Hounslow",
|
207
|
-
'IOW' => "Isle of Wight",
|
208
|
-
'IOS' => "Isles of Scilly",
|
209
|
-
'ISL' => "Islington",
|
210
|
-
'KEC' => "Kensington and Chelsea",
|
211
|
-
'KEN' => "Kent",
|
212
|
-
'KHL' => "Kingston upon Hull City of",
|
213
|
-
'KTT' => "Kingston upon Thames",
|
214
|
-
'KIR' => "Kirklees",
|
215
|
-
'KWL' => "Knowsley",
|
216
|
-
'LBH' => "Lambeth",
|
217
|
-
'LAN' => "Lancashire",
|
218
|
-
'LDS' => "Leeds",
|
219
|
-
'LCE' => "Leicester",
|
220
|
-
'LEC' => "Leicestershire",
|
221
|
-
'LEW' => "Lewisham",
|
222
|
-
'LIN' => "Lincolnshire",
|
223
|
-
'LIV' => "Liverpool",
|
224
|
-
'LND' => "London City of",
|
225
|
-
'LUT' => "Luton",
|
226
|
-
'MAN' => "Manchester",
|
227
|
-
'MDW' => "Medway",
|
228
|
-
'MRT' => "Merton",
|
229
|
-
'MDB' => "Middlesbrough",
|
230
|
-
'MIK' => "Milton Keynes",
|
231
|
-
'NET' => "Newcastle upon Tyne",
|
232
|
-
'NWM' => "Newham",
|
233
|
-
'NFK' => "Norfolk",
|
234
|
-
'NEL' => "North East Lincolnshire",
|
235
|
-
'NLN' => "North Lincolnshire",
|
236
|
-
'NSM' => "North Somerset",
|
237
|
-
'NTY' => "North Tyneside",
|
238
|
-
'NYK' => "North Yorkshire",
|
239
|
-
'NTH' => "Northamptonshire",
|
240
|
-
'NBL' => "Northumberland",
|
241
|
-
'NGM' => "Nottingham",
|
242
|
-
'NTT' => "Nottinghamshire",
|
243
|
-
'OLD' => "Oldham",
|
244
|
-
'OXF' => "Oxfordshire",
|
245
|
-
'PTE' => "Peterborough",
|
246
|
-
'PLY' => "Plymouth",
|
247
|
-
'POL' => "Poole",
|
248
|
-
'POR' => "Portsmouth",
|
249
|
-
'RDG' => "Reading",
|
250
|
-
'RDB' => "Redbridge",
|
251
|
-
'RCC' => "Redcar and Cleveland",
|
252
|
-
'RIC' => "Richmond upon Thames",
|
253
|
-
'RCH' => "Rochdale",
|
254
|
-
'ROT' => "Rotherham",
|
255
|
-
'RUT' => "Rutland",
|
256
|
-
'SHN' => "St Helens",
|
257
|
-
'SLF' => "Salford",
|
258
|
-
'SAW' => "Sandwell",
|
259
|
-
'SFT' => "Sefton",
|
260
|
-
'SHF' => "Sheffield",
|
261
|
-
'SHR' => "Shropshire",
|
262
|
-
'SLG' => "Slough",
|
263
|
-
'SOL' => "Solihull",
|
264
|
-
'SOM' => "Somerset",
|
265
|
-
'SGC' => "South Gloucestershire",
|
266
|
-
'STY' => "South Tyneside",
|
267
|
-
'STH' => "Southampton",
|
268
|
-
'SOS' => "Southend-on-Sea",
|
269
|
-
'SWK' => "Southwark",
|
270
|
-
'STS' => "Staffordshire",
|
271
|
-
'SKP' => "Stockport",
|
272
|
-
'STT' => "Stockton-on-Tees",
|
273
|
-
'STE' => "Stoke-on-Trent",
|
274
|
-
'SFK' => "Suffolk",
|
275
|
-
'SND' => "Sunderland",
|
276
|
-
'SRY' => "Surrey",
|
277
|
-
'STN' => "Sutton",
|
278
|
-
'SWD' => "Swindon",
|
279
|
-
'TAM' => "Tameside",
|
280
|
-
'TFW' => "Telford and Wrekin",
|
281
|
-
'THR' => "Thurrock",
|
282
|
-
'TOB' => "Torbay",
|
283
|
-
'TWH' => "Tower Hamlets",
|
284
|
-
'TRF' => "Trafford",
|
285
|
-
'WKF' => "Wakefield",
|
286
|
-
'WLL' => "Walsall",
|
287
|
-
'WFT' => "Waltham Forest",
|
288
|
-
'WND' => "Wandsworth",
|
289
|
-
'WRT' => "Warrington",
|
290
|
-
'WAR' => "Warwickshire",
|
291
|
-
'WBK' => "West Berkshire",
|
292
|
-
'WSX' => "West Sussex",
|
293
|
-
'WSM' => "Westminster",
|
294
|
-
'WGN' => "Wigan",
|
295
|
-
'WIL' => "Wiltshire",
|
296
|
-
'WNM' => "Windsor and Maidenhead",
|
297
|
-
'WRL' => "Wirral",
|
298
|
-
'WOK' => "Wokingham",
|
299
|
-
'WLV' => "Wolverhampton",
|
300
|
-
'WOR' => "Worcestershire",
|
301
|
-
'YOR' => "York",
|
302
|
-
'ANT' => "Antrim",
|
303
|
-
'ARD' => "Ards",
|
304
|
-
'ARM' => "Armagh",
|
305
|
-
'BLA' => "Ballymena",
|
306
|
-
'BLY' => "Ballymoney",
|
307
|
-
'BNB' => "Banbridge",
|
308
|
-
'BFS' => "Belfast",
|
309
|
-
'CKF' => "Carrickfergus",
|
310
|
-
'CSR' => "Castlereagh",
|
311
|
-
'CLR' => "Coleraine",
|
312
|
-
'CKT' => "Cookstown",
|
313
|
-
'CGV' => "Craigavon",
|
314
|
-
'DRY' => "Derry",
|
315
|
-
'DOW' => "Down",
|
316
|
-
'DGN' => "Dungannon and South Tyrone",
|
317
|
-
'FER' => "Fermanagh",
|
318
|
-
'LRN' => "Larne",
|
319
|
-
'LMV' => "Limavady",
|
320
|
-
'LSB' => "Lisburn",
|
321
|
-
'MFT' => "Magherafelt",
|
322
|
-
'MYL' => "Moyle",
|
323
|
-
'NYM' => "Newry and Mourne",
|
324
|
-
'NTA' => "Newtownabbey",
|
325
|
-
'NDN' => "North Down",
|
326
|
-
'OMH' => "Omagh",
|
327
|
-
'STB' => "Strabane",
|
328
|
-
'ABE' => "Aberdeen",
|
329
|
-
'ABD' => "Aberdeenshire",
|
330
|
-
'ANS' => "Angus",
|
331
|
-
'AGB' => "Argyll and Bute",
|
332
|
-
'CLK' => "Clackmannanshire",
|
333
|
-
'DGY' => "Dumfries and Galloway",
|
334
|
-
'DND' => "Dundee",
|
335
|
-
'EAY' => "East Ayrshire",
|
336
|
-
'EDU' => "East Dunbartonshire",
|
337
|
-
'ELN' => "East Lothian",
|
338
|
-
'ERW' => "East Renfrewshire",
|
339
|
-
'EDH' => "Edinburgh",
|
340
|
-
'ELS' => "Eilean Siar",
|
341
|
-
'FAL' => "Falkirk",
|
342
|
-
'FIF' => "Fife",
|
343
|
-
'GLG' => "Glasgow",
|
344
|
-
'HLD' => "Highland",
|
345
|
-
'IVC' => "Inverclyde",
|
346
|
-
'NAY' => "North Ayrshire",
|
347
|
-
'NLK' => "North Lanarkshire",
|
348
|
-
'ORK' => "Orkney Islands",
|
349
|
-
'PKN' => "Perth and Kinross",
|
350
|
-
'MLN' => "Midlothian",
|
351
|
-
'MRY' => "Moray",
|
352
|
-
'RFW' => "Renfrewshire",
|
353
|
-
'SCB' => "Scottish Borders The",
|
354
|
-
'ZET' => "Shetland Islands",
|
355
|
-
'SAY' => "South Ayrshire",
|
356
|
-
'SLK' => "South Lanarkshire",
|
357
|
-
'STG' => "Stirling",
|
358
|
-
'WDU' => "West Dunbartonshire",
|
359
|
-
'WLN' => "West Lothian",
|
360
|
-
'BGW' => "Blaenau Gwent",
|
361
|
-
'BGE' => "Bridgend",
|
362
|
-
'CAY' => "Caerphilly",
|
363
|
-
'CRF' => "Cardiff",
|
364
|
-
'CMN' => "Carmarthenshire",
|
365
|
-
'CGN' => "Ceredigion",
|
366
|
-
'CWY' => "Conwy",
|
367
|
-
'DEN' => "Denbighshire",
|
368
|
-
'FLN' => "Flintshire",
|
369
|
-
'GWN' => "Gwynedd",
|
370
|
-
'AGY' => "Isle of Anglesey",
|
371
|
-
'MTY' => "Merthyr Tydfil",
|
372
|
-
'MON' => "Monmouthshire",
|
373
|
-
'NTL' => "Neath Port Talbot",
|
374
|
-
'NWP' => "Newport",
|
375
|
-
'PEM' => "Pembrokeshire",
|
376
|
-
'POW' => "Powys",
|
377
|
-
'RCT' => "Rhondda Cynon Taf",
|
378
|
-
'SWA' => "Swansea",
|
379
|
-
'TOF' => "Torfaen",
|
380
|
-
'VGL' => "Vale of Glamorgan",
|
381
|
-
'WRX' => "Wrexham",
|
382
|
-
'ABD' => 'Aberdeenshire',
|
383
|
-
'ALD' => 'Alderney',
|
384
|
-
'AGY' => 'Anglesey (Isle of)',
|
385
|
-
'ANS' => 'Angus',
|
386
|
-
'AGB' => 'Argyll and Bute',
|
387
|
-
'AYR' => 'Ayrshire',
|
388
|
-
'BAN' => 'Banffshire',
|
389
|
-
'BDF' => 'Bedfordshire',
|
390
|
-
'BRK' => 'Berkshire',
|
391
|
-
'BEW' => 'Berwickshire',
|
392
|
-
'BGW' => 'Blaenau Gwent',
|
393
|
-
'BOR' => 'Borders',
|
394
|
-
'BGE' => 'Bridgend',
|
395
|
-
'BST' => 'Bristol',
|
396
|
-
'BKM' => 'Buckinghamshire',
|
397
|
-
'CAY' => 'Caerphilly',
|
398
|
-
'CAI' => 'Caithness',
|
399
|
-
'CAM' => 'Cambridgeshire',
|
400
|
-
'CRF' => 'Cardiff',
|
401
|
-
'CMN' => 'Carmarthenshire',
|
402
|
-
'CEN' => 'Central Scotland',
|
403
|
-
'CGN' => 'Ceredigion',
|
404
|
-
'CHI' => 'Channel Islands',
|
405
|
-
'CHS' => 'Cheshire',
|
406
|
-
'CLK' => 'Clackmannanshire',
|
407
|
-
'CWD' => 'Clwyd',
|
408
|
-
'CWY' => 'Conwy',
|
409
|
-
'CON' => 'Cornwall',
|
410
|
-
'ANT' => 'County Antrim',
|
411
|
-
'ARM' => 'County Armagh',
|
412
|
-
'DOW' => 'County Down',
|
413
|
-
'DUR' => 'County Durham',
|
414
|
-
'TYR' => 'County Tyrone',
|
415
|
-
'CMA' => 'Cumbria',
|
416
|
-
'DEN' => 'Denbighshire',
|
417
|
-
'DER' => 'Derbyshire',
|
418
|
-
'DEV' => 'Devon',
|
419
|
-
'DOR' => 'Dorset',
|
420
|
-
'DGY' => 'Dumfries & Galloway',
|
421
|
-
'DNB' => 'Dunbartonshire',
|
422
|
-
'DYD' => 'Dyfed',
|
423
|
-
'ELN' => 'East Lothian',
|
424
|
-
'ERY' => 'East Riding of Yorkshire',
|
425
|
-
'ESX' => 'East Sussex',
|
426
|
-
'ESS' => 'Essex',
|
427
|
-
'FER' => 'Fermanagh',
|
428
|
-
'FIF' => 'Fife',
|
429
|
-
'FLN' => 'Flintshire',
|
430
|
-
'GLA' => 'Glamorgan',
|
431
|
-
'GLS' => 'Gloucestershire',
|
432
|
-
'GMP' => 'Grampian',
|
433
|
-
'GSY' => 'Guernsey',
|
434
|
-
'GNT' => 'Gwent',
|
435
|
-
'GWN' => 'Gwynedd',
|
436
|
-
'HAM' => 'Hampshire',
|
437
|
-
'HEF' => 'Herefordshire',
|
438
|
-
'HRT' => 'Hertfordshire',
|
439
|
-
'HLD' => 'Highlands',
|
440
|
-
'INV' => 'Inverness-shire',
|
441
|
-
'IOM' => 'Isle of Man',
|
442
|
-
'IOW' => 'Isle of Wight',
|
443
|
-
'JSY' => 'Jersey',
|
444
|
-
'KEN' => 'Kent',
|
445
|
-
'KCD' => 'Kincardineshire',
|
446
|
-
'KRS' => 'Kinross-shire',
|
447
|
-
'KKD' => 'Kirkcudbrightshire',
|
448
|
-
'LKS' => 'Lanarkshire',
|
449
|
-
'LAN' => 'Lancashire',
|
450
|
-
'LEI' => 'Leicestershire',
|
451
|
-
'LIN' => 'Lincolnshire',
|
452
|
-
'LND' => 'London',
|
453
|
-
'LDY' => 'Londonderry',
|
454
|
-
'GTM' => 'Manchester (Greater)',
|
455
|
-
'MSY' => 'Merseyside',
|
456
|
-
'MTY' => 'Merthyr Tydfil',
|
457
|
-
'MDX' => 'Middlesex',
|
458
|
-
'MLN' => 'Midlothian',
|
459
|
-
'MON' => 'Monmouthshire',
|
460
|
-
'MOR' => 'Moray',
|
461
|
-
'NAI' => 'Nairnshire',
|
462
|
-
'NTL' => 'Neath Port Talbot',
|
463
|
-
'NWP' => 'Newport',
|
464
|
-
'NFK' => 'Norfolk',
|
465
|
-
'NYK' => 'North Yorkshire',
|
466
|
-
'NTH' => 'Northamptonshire',
|
467
|
-
'NBL' => 'Northumberland',
|
468
|
-
'NTT' => 'Nottinghamshire',
|
469
|
-
'OKI' => 'Orkney',
|
470
|
-
'OXF' => 'Oxfordshire',
|
471
|
-
'PEE' => 'Peeblesshire',
|
472
|
-
'PEM' => 'Pembrokeshire',
|
473
|
-
'PER' => 'Perthshire',
|
474
|
-
'POW' => 'Powys',
|
475
|
-
'RFW' => 'Renfrewshire',
|
476
|
-
'RCT' => 'Rhondda Cynon Taff',
|
477
|
-
'ROC' => 'Ross and Cromarty',
|
478
|
-
'ROX' => 'Roxburghshire',
|
479
|
-
'SEL' => 'Selkirkshire',
|
480
|
-
'SHI' => 'Shetland',
|
481
|
-
'SHR' => 'Shropshire',
|
482
|
-
'SOM' => 'Somerset',
|
483
|
-
'SYK' => 'South Yorkshire',
|
484
|
-
'STS' => 'Staffordshire',
|
485
|
-
'STI' => 'Stirlingshire',
|
486
|
-
'STD' => 'Strathclyde',
|
487
|
-
'SFK' => 'Suffolk',
|
488
|
-
'SRY' => 'Surrey',
|
489
|
-
'SUT' => 'Sutherland',
|
490
|
-
'SWA' => 'Swansea',
|
491
|
-
'TAY' => 'Tayside',
|
492
|
-
'TOF' => 'Torfaen',
|
493
|
-
'TWR' => 'Tyne & Wear',
|
494
|
-
'WAR' => 'Warwickshire',
|
495
|
-
'WLN' => 'West Lothian',
|
496
|
-
'WMD' => 'West Midlands',
|
497
|
-
'SXW' => 'West Sussex',
|
498
|
-
'WYK' => 'West Yorkshire',
|
499
|
-
'WIS' => 'Western Isles',
|
500
|
-
'WIG' => 'Wigtownshire',
|
501
|
-
'WIL' => 'Wiltshire',
|
502
|
-
'WOR' => 'Worcestershire',
|
503
|
-
'WRX' => 'Wrexham'
|
504
|
-
]
|
505
|
-
|
506
8
|
def self.countries
|
507
9
|
COUNTRIES
|
508
10
|
end
|
509
11
|
|
510
|
-
def self.
|
511
|
-
(
|
12
|
+
def self.india
|
13
|
+
INDIAN_STATES.merge(INDIAN_TERRIOTORY)
|
512
14
|
end
|
513
15
|
|
514
16
|
def self.us_states
|
@@ -524,6 +26,21 @@ UK_STATES = [
|
|
524
26
|
end
|
525
27
|
|
526
28
|
def self.all_states
|
527
|
-
(
|
29
|
+
INDIAN_STATES.merge(INDIAN_TERRIOTORY).merge(USA_STATE_LIST).merge(CANADIAN_STATES).merge(UK_STATES)
|
30
|
+
end
|
31
|
+
|
32
|
+
module Rails
|
33
|
+
|
528
34
|
end
|
35
|
+
end
|
36
|
+
|
37
|
+
case ::Rails.version.to_s
|
38
|
+
when /^4/
|
39
|
+
require 'country_state_select/engine'
|
40
|
+
when /^3\.[12]/
|
41
|
+
require 'country_state_select/engine3'
|
42
|
+
when /^3\.[0]/
|
43
|
+
require 'country_state_select/railtie'
|
44
|
+
else
|
45
|
+
raise 'Unsupported rails version'
|
529
46
|
end
|