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
@@ -0,0 +1,145 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# @author Arvind Vyas
|
5
|
+
|
6
|
+
module CountryStateSelect
|
7
|
+
module Constant
|
8
|
+
|
9
|
+
# array containing all the countries name in alphabetical order
|
10
|
+
COUNTRIES = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola",
|
11
|
+
"Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria",
|
12
|
+
"Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin",
|
13
|
+
"Bermuda", "Bhutan", "Bolivia, Plurinational State of", "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina",
|
14
|
+
"Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia",
|
15
|
+
"Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
|
16
|
+
"Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba",
|
17
|
+
"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",
|
18
|
+
"Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard Island and McDonald Islands", "Holy See (Vatican City State)",
|
19
|
+
"Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic of", "Iraq",
|
20
|
+
"Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya",
|
21
|
+
"Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan",
|
22
|
+
"Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya",
|
23
|
+
"Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, The Former Yugoslav Republic Of",
|
24
|
+
"Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique",
|
25
|
+
"Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of",
|
26
|
+
"Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru",
|
27
|
+
"Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau",
|
28
|
+
"Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines",
|
29
|
+
"Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation",
|
30
|
+
"Rwanda", "Saint Barthelemy", "Saint Helena, Ascension and Tristan da Cunha", "Saint Kitts and Nevis", "Saint Lucia",
|
31
|
+
"Saint Martin (French Part)", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino",
|
32
|
+
"Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore",
|
33
|
+
"Sint Maarten (Dutch Part)", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa",
|
34
|
+
"South Georgia and the South Sandwich Islands", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname",
|
35
|
+
"Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic",
|
36
|
+
"Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste",
|
37
|
+
"Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan",
|
38
|
+
"Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom",
|
39
|
+
"United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu",
|
40
|
+
"Venezuela, Bolivarian Republic of", "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.",
|
41
|
+
"Wallis and Futuna", "Western Sahara", "Yemen", "Zambia", "Zimbabwe"].sort
|
42
|
+
|
43
|
+
#array containing all the Indian states except Indian Territory
|
44
|
+
INDIAN_STATES = [["Andhra Pradesh", "AP"], ["Arunachal Pradesh", "AR"], ["Assam", "AS"], ["Bihar", "BR"],
|
45
|
+
["Chhattisgarh", "CT"], ["Goa", "GA"], ["Gujarat", "GJ"], ["Haryana", "HR"],
|
46
|
+
["Himachal Pradesh", "HP"], ["Jammu & Kashmir", "JK"], ["Jharkhand", "JH"], ["Karnataka", "KA"],
|
47
|
+
["Kerala", "KL"], ["Madhya Pradesh", "MP"], ["Maharashtra", "MH"], ["Manipur", "MN"],
|
48
|
+
["Meghalaya", "ML"], ["Mizoram", "MZ"], ["Nagaland", "NL"], ["Odisha", "OR"], ["Punjab", "PB"],
|
49
|
+
["Rajasthan", "RJ"], ["Sikkim", "SK"], ["Tamil Nadu", "TN"], ["Tripura", "TR"], ["Uttarakhand", "UK"],
|
50
|
+
["Uttar Pradesh", "UP"], ["West Bengal", "WB"], ["Telangana", "TS"]].sort
|
51
|
+
|
52
|
+
#array containing all the Indian Territory
|
53
|
+
INDIAN_TERRIOTORY = [["Andaman & Nicobar", "AN"], ["Chandigarh", "CH"], ["Dadra and Nagar Haveli", "DN"],
|
54
|
+
["Daman & Diu", "DD"], ["Delhi", "DL"], ["Lakshadweep", "LD"], ["Puducherry", "PY"]].sort
|
55
|
+
|
56
|
+
#array containing us states
|
57
|
+
USA_STATES =[["Alabama", "AL"], ["Alaska", "AK"], ["Arizona", "AZ"], ["Arkansas", "AR"], ["California", "CA"],
|
58
|
+
["Colorado", "CO"], ["Connecticut", "CT"], ["Delaware", "DE"], ["District Of Columbia", "DC"],
|
59
|
+
["Florida", "FL"], ["Georgia", "GA"], ["Hawaii", "HI"], ["Idaho", "ID"], ["Illinois", "IL"],
|
60
|
+
["Indiana", "IN"], ["Iowa", "IA"], ["Kansas", "KS"], ["Kentucky", "KY"], ["Louisiana", "LA"],
|
61
|
+
["Maine", "ME"], ["Maryland", "MD"], ["Massachusetts", "MA"], ["Michigan", "MI"], ["Minnesota", "MN"],
|
62
|
+
["Mississippi", "MS"], ["Missouri", "MO"], ["Montana", "MT"], ["Nebraska", "NE"], ["Nevada", "NV"],
|
63
|
+
["New Hampshire", "NH"], ["New Jersey", "NJ"], ["New Mexico", "NM"], ["New York", "NY"],
|
64
|
+
["North Carolina", "NC"], ["North Dakota", "ND"], ["Ohio", "OH"], ["Oklahoma", "OK"], ["Oregon", "OR"],
|
65
|
+
["Pennsylvania", "PA"], ["Rhode Island", "RI"], ["South Carolina", "SC"], ["South Dakota", "SD"],
|
66
|
+
["Tennessee", "TN"], ["Texas", "TX"], ["Utah", "UT"], ["Vermont", "VT"], ["Virginia", "VA"],
|
67
|
+
["Washington", "WA"], ["West Virginia", "WV"], ["Wisconsin", "WI"], ["Wyoming", "WY"]].sort
|
68
|
+
|
69
|
+
#array containing Canadian states
|
70
|
+
CANADIAN_STATES = [["British Columbia", "BC"], ["Ontario", "ON"], ["Newfoundland and Labrador", "NL"],
|
71
|
+
["Nova Scotia", "NS"], ["Prince Edward Island", "PE"], ["New Brunswick", "NB"], ["Quebec", "QC"],
|
72
|
+
["Manitoba", "MB"], ["Saskatchewan", "SK"], ["Alberta", "AB"], ["Northwest Territories", "NT"],
|
73
|
+
["Nunavut", "NU"], ["Yukon Territory", "YT"]].sort
|
74
|
+
|
75
|
+
#array containing all the uk states
|
76
|
+
UK_STATES = [["Guernsey", "GSY"], ["Jersey", "JSY"], ["Barking and Dagenham", "BDG"], ["Barnet", "BNE"],
|
77
|
+
["Barnsley", "BNS"], ["Bath and North East Somerset", "BAS"], ["Bedfordshire", "BDF"],
|
78
|
+
["Bexley", "BEX"], ["Birmingham", "BIR"], ["Blackburn with Darwen", "BBD"], ["Blackpool", "BPL"],
|
79
|
+
["Bolton", "BOL"], ["Bournemouth", "BMH"], ["Bracknell Forest", "BRC"], ["Bradford", "BRD"],
|
80
|
+
["Brent", "BEN"], ["Brighton and Hove", "BNH"], ["Bristol", "BST"], ["Bromley", "BRY"],
|
81
|
+
["Buckinghamshire", "BKM"], ["Bury", "BUR"], ["Calderdale", "CLD"], ["Cambridgeshire", "CAM"],
|
82
|
+
["Camden", "CMD"], ["Cheshire", "CHS"], ["Cornwall", "CON"], ["Coventry (West Midlands district)", "COV"],
|
83
|
+
["Croydon", "CRY"], ["Cumbria", "CMA"], ["Darlington", "DAL"], ["Derbyshire", "DER"], ["Derbyshire", "DBY"],
|
84
|
+
["Devon", "DEV"], ["Doncaster", "DNC"], ["Dorset", "DOR"], ["Dudley (West Midlands district)", "DUD"],
|
85
|
+
["County Durham", "DUR"], ["Ealing", "EAL"], ["East Riding of Yorkshire", "ERY"], ["East Sussex", "ESX"],
|
86
|
+
["Enfield", "ENF"], ["Essex", "ESS"], ["Gateshead (Tyne & Wear district)", "GAT"], ["Gloucestershire", "GLS"],
|
87
|
+
["Greenwich", "GRE"], ["Hackney", "HCK"], ["Halton", "HAL"], ["Hammersmith and Fulham", "HMF"],
|
88
|
+
["Hampshire", "HAM"], ["Haringey", "HRY"], ["Harrow", "HRW"], ["Hartlepool", "HPL"], ["Havering", "HAV"],
|
89
|
+
["Herefordshire", "HEF"], ["Hertfordshire", "HRT"], ["Hillingdon", "HIL"], ["Hounslow", "HNS"],
|
90
|
+
["Isle of Wight", "IOW"], ["Isles of Scilly", "IOS"], ["Islington", "ISL"], ["Kensington and Chelsea", "KEC"],
|
91
|
+
["Kent", "KEN"], ["Kingston upon Hull City of", "KHL"], ["Kingston upon Thames", "KTT"], ["Kirklees", "KIR"],
|
92
|
+
["Knowsley", "KWL"], ["Lambeth", "LBH"], ["Lancashire", "LAN"], ["Leeds", "LDS"], ["Leicester", "LCE"],
|
93
|
+
["Leicestershire", "LEC"], ["Lewisham", "LEW"], ["Lincolnshire", "LIN"], ["Liverpool", "LIV"],
|
94
|
+
["London", "LND"], ["Luton", "LUT"], ["Manchester", "MAN"], ["Medway", "MDW"], ["Merton", "MRT"],
|
95
|
+
["Middlesbrough", "MDB"], ["Milton Keynes", "MIK"], ["Newcastle upon Tyne", "NET"], ["Newham", "NWM"],
|
96
|
+
["Norfolk", "NFK"], ["North East Lincolnshire", "NEL"], ["North Lincolnshire", "NLN"],
|
97
|
+
["North Somerset", "NSM"], ["North Tyneside", "NTY"], ["North Yorkshire", "NYK"], ["Northamptonshire", "NTH"],
|
98
|
+
["Northumberland", "NBL"], ["Nottingham", "NGM"], ["Nottinghamshire", "NTT"], ["Oldham", "OLD"],
|
99
|
+
["Oxfordshire", "OXF"], ["Peterborough", "PTE"], ["Plymouth", "PLY"], ["Poole", "POL"], ["Portsmouth", "POR"],
|
100
|
+
["Reading", "RDG"], ["Redbridge", "RDB"], ["Redcar and Cleveland", "RCC"], ["Richmond upon Thames", "RIC"],
|
101
|
+
["Rochdale", "RCH"], ["Rotherham", "ROT"], ["Rutland", "RUT"], ["St Helens", "SHN"], ["Salford", "SLF"],
|
102
|
+
["Sandwell", "SAW"], ["Sefton", "SFT"], ["Sheffield", "SHF"], ["Shropshire", "SHR"], ["Slough", "SLG"],
|
103
|
+
["Solihull", "SOL"], ["Somerset", "SOM"], ["South Gloucestershire", "SGC"], ["South Tyneside", "STY"],
|
104
|
+
["Southampton", "STH"], ["Southend-on-Sea", "SOS"], ["Southwark", "SWK"], ["Staffordshire", "STS"],
|
105
|
+
["Stockport", "SKP"], ["Stockton-on-Tees", "STT"], ["Stoke-on-Trent", "STE"], ["Suffolk", "SFK"],
|
106
|
+
["Sunderland", "SND"], ["Surrey", "SRY"], ["Sutton", "STN"], ["Swindon", "SWD"], ["Tameside", "TAM"],
|
107
|
+
["Telford and Wrekin", "TFW"], ["Thurrock", "THR"], ["Torbay", "TOB"], ["Tower Hamlets", "TWH"],
|
108
|
+
["Trafford", "TRF"], ["Wakefield", "WKF"], ["Walsall", "WLL"], ["Waltham Forest", "WFT"],
|
109
|
+
["Wandsworth", "WND"], ["Warrington", "WRT"], ["Warwickshire", "WAR"], ["West Berkshire", "WBK"],
|
110
|
+
["West Sussex", "WSX"], ["Westminster", "WSM"], ["Wigan", "WGN"], ["Wiltshire", "WIL"],
|
111
|
+
["Windsor and Maidenhead", "WNM"], ["Wirral", "WRL"], ["Wokingham", "WOK"], ["Wolverhampton", "WLV"],
|
112
|
+
["Worcestershire", "WOR"], ["York", "YOR"], ["County Antrim", "ANT"], ["Ards", "ARD"],
|
113
|
+
["County Armagh", "ARM"], ["Ballymena", "BLA"], ["Ballymoney", "BLY"], ["Banbridge", "BNB"],
|
114
|
+
["Belfast", "BFS"], ["Carrickfergus", "CKF"], ["Castlereagh", "CSR"], ["Coleraine", "CLR"],
|
115
|
+
["Cookstown", "CKT"], ["Craigavon", "CGV"], ["Derry", "DRY"], ["County Down", "DOW"],
|
116
|
+
["Dungannon and South Tyrone", "DGN"], ["Fermanagh", "FER"], ["Larne", "LRN"], ["Limavady", "LMV"],
|
117
|
+
["Lisburn", "LSB"], ["Magherafelt", "MFT"], ["Moyle", "MYL"], ["Newry and Mourne", "NYM"],
|
118
|
+
["Newtownabbey", "NTA"], ["North Down", "NDN"], ["Omagh", "OMH"], ["Strabane", "STB"], ["Aberdeen", "ABE"],
|
119
|
+
["Aberdeenshire", "ABD"], ["Angus", "ANS"], ["Argyll and Bute", "AGB"], ["Clackmannanshire", "CLK"],
|
120
|
+
["Dumfries & Galloway", "DGY"], ["Dundee", "DND"], ["East Ayrshire", "EAY"], ["East Dunbartonshire", "EDU"],
|
121
|
+
["East Lothian", "ELN"], ["East Renfrewshire", "ERW"], ["Edinburgh", "EDH"], ["Eilean Siar", "ELS"],
|
122
|
+
["Falkirk", "FAL"], ["Fife", "FIF"], ["Glasgow", "GLG"], ["Highlands", "HLD"], ["Inverclyde", "IVC"],
|
123
|
+
["North Ayrshire", "NAY"], ["North Lanarkshire", "NLK"], ["Orkney Islands", "ORK"], ["Perth and Kinross", "PKN"],
|
124
|
+
["Midlothian", "MLN"], ["Moray", "MRY"], ["Renfrewshire", "RFW"], ["Scottish Borders The", "SCB"],
|
125
|
+
["Shetland Islands", "ZET"], ["South Ayrshire", "SAY"], ["South Lanarkshire", "SLK"], ["Stirling", "STG"],
|
126
|
+
["West Dunbartonshire", "WDU"], ["West Lothian", "WLN"], ["Blaenau Gwent", "BGW"], ["Bridgend", "BGE"],
|
127
|
+
["Caerphilly", "CAY"], ["Cardiff", "CRF"], ["Carmarthenshire", "CMN"], ["Ceredigion", "CGN"],
|
128
|
+
["Conwy", "CWY"], ["Denbighshire", "DEN"], ["Flintshire", "FLN"], ["Gwynedd", "GWN"],
|
129
|
+
["Anglesey (Isle of)", "AGY"], ["Merthyr Tydfil", "MTY"], ["Monmouthshire", "MON"],
|
130
|
+
["Neath Port Talbot", "NTL"], ["Newport", "NWP"], ["Pembrokeshire", "PEM"], ["Powys", "POW"],
|
131
|
+
["Rhondda Cynon Taff", "RCT"], ["Swansea", "SWA"], ["Torfaen", "TOF"], ["Vale of Glamorgan", "VGL"],
|
132
|
+
["Wrexham", "WRX"], ["Alderney", "ALD"], ["Ayrshire", "AYR"], ["Banffshire", "BAN"], ["Berkshire", "BRK"],
|
133
|
+
["Berwickshire", "BEW"], ["Borders", "BOR"], ["Caithness", "CAI"], ["Central Scotland", "CEN"],
|
134
|
+
["Channel Islands", "CHI"], ["Clwyd", "CWD"], ["County Tyrone", "TYR"], ["Dunbartonshire", "DNB"],
|
135
|
+
["Dyfed", "DYD"], ["Glamorgan", "GLA"], ["Grampian", "GMP"], ["Gwent", "GNT"], ["Inverness-shire", "INV"],
|
136
|
+
["Isle of Man", "IOM"], ["Kincardineshire", "KCD"], ["Kinross-shire", "KRS"], ["Kirkcudbrightshire", "KKD"],
|
137
|
+
["Lanarkshire", "LKS"], ["Leicestershire", "LEI"], ["Londonderry", "LDY"], ["Manchester (Greater)", "GTM"],
|
138
|
+
["Merseyside", "MSY"], ["Middlesex", "MDX"], ["Moray", "MOR"], ["Nairnshire", "NAI"], ["Orkney", "OKI"],
|
139
|
+
["Peeblesshire", "PEE"], ["Perthshire", "PER"], ["Ross and Cromarty", "ROC"], ["Roxburghshire", "ROX"],
|
140
|
+
["Selkirkshire", "SEL"], ["Shetland", "SHI"], ["South Yorkshire", "SYK"], ["Stirlingshire", "STI"],
|
141
|
+
["Strathclyde", "STD"], ["Sutherland", "SUT"], ["Tayside", "TAY"], ["Tyne & Wear", "TWR"],
|
142
|
+
["West Midlands", "WMD"], ["West Sussex", "SXW"], ["West Yorkshire", "WYK"], ["Western Isles", "WIS"],
|
143
|
+
["Wigtownshire", "WIG"]].sort
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
/db/*.sqlite3-journal
|
13
|
+
|
14
|
+
# Ignore all logfiles and tempfiles.
|
15
|
+
/log/*.log
|
16
|
+
/tmp
|
data/test/dummy/Gemfile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
4
|
+
gem 'rails', '4.0.5'
|
5
|
+
|
6
|
+
# Use sqlite3 as the database for Active Record
|
7
|
+
gem 'sqlite3'
|
8
|
+
|
9
|
+
# Use SCSS for stylesheets
|
10
|
+
gem 'sass-rails', '~> 4.0.2'
|
11
|
+
|
12
|
+
# Use Uglifier as compressor for JavaScript assets
|
13
|
+
gem 'uglifier', '>= 1.3.0'
|
14
|
+
|
15
|
+
gem 'country_state_select', path: '../../'
|
16
|
+
|
17
|
+
# Use CoffeeScript for .js.coffee assets and views
|
18
|
+
gem 'coffee-rails', '~> 4.0.0'
|
19
|
+
|
20
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
21
|
+
# gem 'therubyracer', platforms: :ruby
|
22
|
+
|
23
|
+
# Use jquery as the JavaScript library
|
24
|
+
gem 'jquery-rails'
|
25
|
+
|
26
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
27
|
+
gem 'turbolinks'
|
28
|
+
|
29
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
30
|
+
gem 'jbuilder', '~> 1.2'
|
31
|
+
|
32
|
+
group :doc do
|
33
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
34
|
+
gem 'sdoc', require: false
|
35
|
+
end
|
36
|
+
|
37
|
+
# Use ActiveModel has_secure_password
|
38
|
+
# gem 'bcrypt', '~> 3.1.7'
|
39
|
+
|
40
|
+
# Use unicorn as the app server
|
41
|
+
# gem 'unicorn'
|
42
|
+
|
43
|
+
# Use Capistrano for deployment
|
44
|
+
# gem 'capistrano', group: :development
|
45
|
+
|
46
|
+
# Use debugger
|
47
|
+
# gem 'debugger', group: [:development, :test]
|
data/test/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require country_state_select
|
17
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,69 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
p, ol, ul, td {
|
10
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
11
|
+
font-size: 13px;
|
12
|
+
line-height: 18px;
|
13
|
+
}
|
14
|
+
|
15
|
+
pre {
|
16
|
+
background-color: #eee;
|
17
|
+
padding: 10px;
|
18
|
+
font-size: 11px;
|
19
|
+
}
|
20
|
+
|
21
|
+
a {
|
22
|
+
color: #000;
|
23
|
+
&:visited {
|
24
|
+
color: #666;
|
25
|
+
}
|
26
|
+
&:hover {
|
27
|
+
color: #fff;
|
28
|
+
background-color: #000;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
div {
|
33
|
+
&.field, &.actions {
|
34
|
+
margin-bottom: 10px;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
#notice {
|
39
|
+
color: green;
|
40
|
+
}
|
41
|
+
|
42
|
+
.field_with_errors {
|
43
|
+
padding: 2px;
|
44
|
+
background-color: red;
|
45
|
+
display: table;
|
46
|
+
}
|
47
|
+
|
48
|
+
#error_explanation {
|
49
|
+
width: 450px;
|
50
|
+
border: 2px solid red;
|
51
|
+
padding: 7px;
|
52
|
+
padding-bottom: 0;
|
53
|
+
margin-bottom: 20px;
|
54
|
+
background-color: #f0f0f0;
|
55
|
+
h2 {
|
56
|
+
text-align: left;
|
57
|
+
font-weight: bold;
|
58
|
+
padding: 5px 5px 5px 15px;
|
59
|
+
font-size: 12px;
|
60
|
+
margin: -7px;
|
61
|
+
margin-bottom: 0px;
|
62
|
+
background-color: #c00;
|
63
|
+
color: #fff;
|
64
|
+
}
|
65
|
+
ul li {
|
66
|
+
font-size: 12px;
|
67
|
+
list-style: square;
|
68
|
+
}
|
69
|
+
}
|
File without changes
|
@@ -0,0 +1,74 @@
|
|
1
|
+
class UsersController < ApplicationController
|
2
|
+
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
3
|
+
|
4
|
+
# GET /users
|
5
|
+
# GET /users.json
|
6
|
+
def index
|
7
|
+
@users = User.all
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /users/1
|
11
|
+
# GET /users/1.json
|
12
|
+
def show
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /users/new
|
16
|
+
def new
|
17
|
+
@user = User.new
|
18
|
+
end
|
19
|
+
|
20
|
+
# GET /users/1/edit
|
21
|
+
def edit
|
22
|
+
end
|
23
|
+
|
24
|
+
# POST /users
|
25
|
+
# POST /users.json
|
26
|
+
def create
|
27
|
+
@user = User.new(user_params)
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
if @user.save
|
31
|
+
format.html { redirect_to @user, notice: 'User was successfully created.' }
|
32
|
+
format.json { render action: 'show', status: :created, location: @user }
|
33
|
+
else
|
34
|
+
format.html { render action: 'new' }
|
35
|
+
format.json { render json: @user.errors, status: :unprocessable_entity }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# PATCH/PUT /users/1
|
41
|
+
# PATCH/PUT /users/1.json
|
42
|
+
def update
|
43
|
+
respond_to do |format|
|
44
|
+
if @user.update(user_params)
|
45
|
+
format.html { redirect_to @user, notice: 'User was successfully updated.' }
|
46
|
+
format.json { head :no_content }
|
47
|
+
else
|
48
|
+
format.html { render action: 'edit' }
|
49
|
+
format.json { render json: @user.errors, status: :unprocessable_entity }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# DELETE /users/1
|
55
|
+
# DELETE /users/1.json
|
56
|
+
def destroy
|
57
|
+
@user.destroy
|
58
|
+
respond_to do |format|
|
59
|
+
format.html { redirect_to users_url }
|
60
|
+
format.json { head :no_content }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
# Use callbacks to share common setup or constraints between actions.
|
66
|
+
def set_user
|
67
|
+
@user = User.find(params[:id])
|
68
|
+
end
|
69
|
+
|
70
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
71
|
+
def user_params
|
72
|
+
params.require(:user).permit(:name, :email, :country_id, :state_id, :state_name, :country_name)
|
73
|
+
end
|
74
|
+
end
|