From 45f51c9a27d840f702e744dc98eb2a089f22603f Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 16 Apr 2018 15:12:03 +0100 Subject: [PATCH] change country select to proper angular setup so pre population works it may have been broken from an angular upgrade or similar. --- services/web/app/views/subscriptions/new.pug | 262 +----------------- .../coffee/main/new-subscription.coffee | 72 ++++- 2 files changed, 76 insertions(+), 258 deletions(-) diff --git a/services/web/app/views/subscriptions/new.pug b/services/web/app/views/subscriptions/new.pug index a6a2913879..b5c438af8b 100644 --- a/services/web/app/views/subscriptions/new.pug +++ b/services/web/app/views/subscriptions/new.pug @@ -153,9 +153,12 @@ block content ng-model="data.country" name="country" ng-change="updateCountry()" - required + required, + ng-options="country.code as country.name for country in countries", + ng-selected="{{country.code == data.country}}" ) - +countries_options() + option(value='', disabled, selected) #{translate("country")} + option(value='-') -------------- span.input-feedback-message {{ simpleCCForm.country.$error.required ? 'This field is required' : '' }} if (showVatField) @@ -249,258 +252,3 @@ block content ) p For #[strong Visa, MasterCard and Discover], the #[strong 3 digits] on the #[strong back] of your card. p For #[strong American Express], the #[strong 4 digits] on the #[strong front] of your card. - -mixin countries_options() - option(value='', disabled, selected) #{translate("country")} - option(value='-') -------------- - option(value='AF') Afghanistan - option(value='AL') Albania - option(value='DZ') Algeria - option(value='AS') American Samoa - option(value='AD') Andorra - option(value='AO') Angola - option(value='AI') Anguilla - option(value='AQ') Antarctica - option(value='AG') Antigua and Barbuda - option(value='AR') Argentina - option(value='AM') Armenia - option(value='AW') Aruba - option(value='AC') Ascension Island - option(value='AU') Australia - option(value='AT') Austria - option(value='AZ') Azerbaijan - option(value='BS') Bahamas - option(value='BH') Bahrain - option(value='BD') Bangladesh - option(value='BB') Barbados - option(value='BE') Belgium - option(value='BZ') Belize - option(value='BJ') Benin - option(value='BM') Bermuda - option(value='BT') Bhutan - option(value='BO') Bolivia - option(value='BA') Bosnia and Herzegovina - option(value='BW') Botswana - option(value='BV') Bouvet Island - option(value='BR') Brazil - option(value='BQ') British Antarctic Territory - option(value='IO') British Indian Ocean Territory - option(value='VG') British Virgin Islands - option(value='BN') Brunei - option(value='BG') Bulgaria - option(value='BF') Burkina Faso - option(value='BI') Burundi - option(value='KH') Cambodia - option(value='CM') Cameroon - option(value='CA') Canada - option(value='IC') Canary Islands - option(value='CT') Canton and Enderbury Islands - option(value='CV') Cape Verde - option(value='KY') Cayman Islands - option(value='CF') Central African Republic - option(value='EA') Ceuta and Melilla - option(value='TD') Chad - option(value='CL') Chile - option(value='CN') China - option(value='CX') Christmas Island - option(value='CP') Clipperton Island - option(value='CC') Cocos [Keeling] Islands - option(value='CO') Colombia - option(value='KM') Comoros - option(value='CD') Congo [DRC] - option(value='CK') Cook Islands - option(value='CR') Costa Rica - option(value='HR') Croatia - option(value='CU') Cuba - option(value='CY') Cyprus - option(value='CZ') Czech Republic - option(value='DK') Denmark - option(value='DG') Diego Garcia - option(value='DJ') Djibouti - option(value='DM') Dominica - option(value='DO') Dominican Republic - option(value='NQ') Dronning Maud Land - option(value='TL') East Timor - option(value='EC') Ecuador - option(value='EG') Egypt - option(value='SV') El Salvador - option(value='EE') Estonia - option(value='ET') Ethiopia - option(value='FK') Falkland Islands [Islas Malvinas] - option(value='FO') Faroe Islands - option(value='FJ') Fiji - option(value='FI') Finland - option(value='FR') France - option(value='GF') French Guiana - option(value='PF') French Polynesia - option(value='TF') French Southern Territories - option(value='FQ') French Southern and Antarctic Territories - option(value='GA') Gabon - option(value='GM') Gambia - option(value='GE') Georgia - option(value='DE') Germany - option(value='GH') Ghana - option(value='GI') Gibraltar - option(value='GR') Greece - option(value='GL') Greenland - option(value='GD') Grenada - option(value='GP') Guadeloupe - option(value='GU') Guam - option(value='GT') Guatemala - option(value='GG') Guernsey - option(value='GW') Guinea-Bissau - option(value='GY') Guyana - option(value='HT') Haiti - option(value='HM') Heard Island and McDonald Islands - option(value='HN') Honduras - option(value='HK') Hong Kong - option(value='HU') Hungary - option(value='IS') Iceland - option(value='IN') India - option(value='ID') Indonesia - option(value='IE') Ireland - option(value='IM') Isle of Man - option(value='IL') Israel - option(value='IT') Italy - option(value='JM') Jamaica - option(value='JP') Japan - option(value='JE') Jersey - option(value='JT') Johnston Island - option(value='JO') Jordan - option(value='KZ') Kazakhstan - option(value='KE') Kenya - option(value='KI') Kiribati - option(value='KW') Kuwait - option(value='KG') Kyrgyzstan - option(value='LA') Laos - option(value='LV') Latvia - option(value='LS') Lesotho - option(value='LY') Libya - option(value='LI') Liechtenstein - option(value='LT') Lithuania - option(value='LU') Luxembourg - option(value='MO') Macau - option(value='MK') Macedonia [FYROM] - option(value='MG') Madagascar - option(value='MW') Malawi - option(value='MY') Malaysia - option(value='MV') Maldives - option(value='ML') Mali - option(value='MT') Malta - option(value='MH') Marshall Islands - option(value='MQ') Martinique - option(value='MR') Mauritania - option(value='MU') Mauritius - option(value='YT') Mayotte - option(value='FX') Metropolitan France - option(value='MX') Mexico - option(value='FM') Micronesia - option(value='MI') Midway Islands - option(value='MD') Moldova - option(value='MC') Monaco - option(value='MN') Mongolia - option(value='ME') Montenegro - option(value='MS') Montserrat - option(value='MA') Morocco - option(value='MZ') Mozambique - option(value='NA') Namibia - option(value='NR') Nauru - option(value='NP') Nepal - option(value='NL') Netherlands - option(value='AN') Netherlands Antilles - option(value='NT') Neutral Zone - option(value='NC') New Caledonia - option(value='NZ') New Zealand - option(value='NI') Nicaragua - option(value='NE') Niger - option(value='NG') Nigeria - option(value='NU') Niue - option(value='NF') Norfolk Island - option(value='VD') North Vietnam - option(value='MP') Northern Mariana Islands - option(value='NO') Norway - option(value='OM') Oman - option(value='QO') Outlying Oceania - option(value='PC') Pacific Islands Trust Territory - option(value='PK') Pakistan - option(value='PW') Palau - option(value='PS') Palestinian Territories - option(value='PA') Panama - option(value='PZ') Panama Canal Zone - option(value='PY') Paraguay - option(value='YD') People's Democratic Republic of Yemen - option(value='PE') Peru - option(value='PH') Philippines - option(value='PN') Pitcairn Islands - option(value='PL') Poland - option(value='PT') Portugal - option(value='PR') Puerto Rico - option(value='QA') Qatar - option(value='RO') Romania - option(value='RU') Russia - option(value='RW') Rwanda - option(value='RE') Réunion - option(value='BL') Saint Barthélemy - option(value='SH') Saint Helena - option(value='KN') Saint Kitts and Nevis - option(value='LC') Saint Lucia - option(value='MF') Saint Martin - option(value='PM') Saint Pierre and Miquelon - option(value='VC') Saint Vincent and the Grenadines - option(value='WS') Samoa - option(value='SM') San Marino - option(value='SA') Saudi Arabia - option(value='SN') Senegal - option(value='RS') Serbia - option(value='CS') Serbia and Montenegro - option(value='SC') Seychelles - option(value='SL') Sierra Leone - option(value='SG') Singapore - option(value='SK') Slovakia - option(value='SI') Slovenia - option(value='SB') Solomon Islands - option(value='ZA') South Africa - option(value='GS') South Georgia and the South Sandwich Islands - option(value='KR') South Korea - option(value='ES') Spain - option(value='LK') Sri Lanka - option(value='SR') Suriname - option(value='SJ') Svalbard and Jan Mayen - option(value='SZ') Swaziland - option(value='SE') Sweden - option(value='CH') Switzerland - option(value='ST') São Tomé and Príncipe - option(value='TW') Taiwan - option(value='TJ') Tajikistan - option(value='TZ') Tanzania - option(value='TH') Thailand - option(value='TG') Togo - option(value='TK') Tokelau - option(value='TO') Tonga - option(value='TT') Trinidad and Tobago - option(value='TA') Tristan da Cunha - option(value='TN') Tunisia - option(value='TR') Turkey - option(value='TM') Turkmenistan - option(value='TC') Turks and Caicos Islands - option(value='TV') Tuvalu - option(value='UM') U.S. Minor Outlying Islands - option(value='PU') U.S. Miscellaneous Pacific Islands - option(value='VI') U.S. Virgin Islands - option(value='UG') Uganda - option(value='UA') Ukraine - option(value='AE') United Arab Emirates - option(value='GB') United Kingdom - option(value='US') United States - option(value='UY') Uruguay - option(value='UZ') Uzbekistan - option(value='VU') Vanuatu - option(value='VA') Vatican City - option(value='VE') Venezuela - option(value='VN') Vietnam - option(value='WK') Wake Island - option(value='WF') Wallis and Futuna - option(value='EH') Western Sahara - option(value='YE') Yemen - option(value='ZM') Zambia - option(value='AX') Åland Islands diff --git a/services/web/public/coffee/main/new-subscription.coffee b/services/web/public/coffee/main/new-subscription.coffee index 02939a3b9c..31d8e37f40 100644 --- a/services/web/public/coffee/main/new-subscription.coffee +++ b/services/web/public/coffee/main/new-subscription.coffee @@ -163,4 +163,74 @@ define [ recurly.token $scope.data, completeSubscription - + $scope.countries = [ + {code:'AF',name:'Afghanistan'},{code:'AL',name:'Albania'},{code:'DZ',name:'Algeria'},{code:'AS',name:'American Samoa'}, + {code:'AD',name:'Andorra'},{code:'AO',name:'Angola'},{code:'AI',name:'Anguilla'},{code:'AQ',name:'Antarctica'}, + {code:'AG',name:'Antigua and Barbuda'},{code:'AR',name:'Argentina'},{code:'AM',name:'Armenia'},{code:'AW',name:'Aruba'}, + {code:'AC',name:'Ascension Island'},{code:'AU',name:'Australia'},{code:'AT',name:'Austria'},{code:'AZ',name:'Azerbaijan'}, + {code:'BS',name:'Bahamas'},{code:'BH',name:'Bahrain'},{code:'BD',name:'Bangladesh'},{code:'BB',name:'Barbados'}, + {code:'BE',name:'Belgium'},{code:'BZ',name:'Belize'},{code:'BJ',name:'Benin'},{code:'BM',name:'Bermuda'}, + {code:'BT',name:'Bhutan'},{code:'BO',name:'Bolivia'},{code:'BA',name:'Bosnia and Herzegovina'},{code:'BW',name:'Botswana'}, + {code:'BV',name:'Bouvet Island'},{code:'BR',name:'Brazil'},{code:'BQ',name:'British Antarctic Territory'}, + {code:'IO',name:'British Indian Ocean Territory'},{code:'VG',name:'British Virgin Islands'},{code:'BN',name:'Brunei'}, + {code:'BG',name:'Bulgaria'},{code:'BF',name:'Burkina Faso'},{code:'BI',name:'Burundi'},{code:'KH',name:'Cambodia'}, + {code:'CM',name:'Cameroon'},{code:'CA',name:'Canada'},{code:'IC',name:'Canary Islands'}, + {code:'CT',name:'Canton and Enderbury Islands'},{code:'CV',name:'Cape Verde'},{code:'KY',name:'Cayman Islands'}, + {code:'CF',name:'Central African Republic'},{code:'EA',name:'Ceuta and Melilla'},{code:'TD',name:'Chad'}, + {code:'CL',name:'Chile'},{code:'CN',name:'China'},{code:'CX',name:'Christmas Island'},{code:'CP',name:'Clipperton Island'}, + {code:'CC',name:'Cocos [Keeling] Islands'},{code:'CO',name:'Colombia'},{code:'KM',name:'Comoros'},{code:'CD',name:'Congo [DRC]'}, + {code:'CK',name:'Cook Islands'},{code:'CR',name:'Costa Rica'},{code:'HR',name:'Croatia'},{code:'CU',name:'Cuba'}, + {code:'CY',name:'Cyprus'},{code:'CZ',name:'Czech Republic'},{code:'DK',name:'Denmark'},{code:'DG',name:'Diego Garcia'}, + {code:'DJ',name:'Djibouti'},{code:'DM',name:'Dominica'},{code:'DO',name:'Dominican Republic'}, + {code:'NQ',name:'Dronning Maud Land'},{code:'TL',name:'East Timor'},{code:'EC',name:'Ecuador'},{code:'EG',name:'Egypt'}, + {code:'SV',name:'El Salvador'},{code:'EE',name:'Estonia'},{code:'ET',name:'Ethiopia'}, + {code:'FK',name:'Falkland Islands [Islas Malvinas]'},{code:'FO',name:'Faroe Islands'},{code:'FJ',name:'Fiji'}, + {code:'FI',name:'Finland'},{code:'FR',name:'France'},{code:'GF',name:'French Guiana'},{code:'PF',name:'French Polynesia'}, + {code:'TF',name:'French Southern Territories'},{code:'FQ',name:'French Southern and Antarctic Territories'}, + {code:'GA',name:'Gabon'},{code:'GM',name:'Gambia'},{code:'GE',name:'Georgia'},{code:'DE',name:'Germany'}, + {code:'GH',name:'Ghana'},{code:'GI',name:'Gibraltar'},{code:'GR',name:'Greece'},{code:'GL',name:'Greenland'}, + {code:'GD',name:'Grenada'},{code:'GP',name:'Guadeloupe'},{code:'GU',name:'Guam'},{code:'GT',name:'Guatemala'}, + {code:'GG',name:'Guernsey'},{code:'GW',name:'Guinea-Bissau'},{code:'GY',name:'Guyana'},{code:'HT',name:'Haiti'}, + {code:'HM',name:'Heard Island and McDonald Islands'},{code:'HN',name:'Honduras'},{code:'HK',name:'Hong Kong'}, + {code:'HU',name:'Hungary'},{code:'IS',name:'Iceland'},{code:'IN',name:'India'},{code:'ID',name:'Indonesia'}, + {code:'IE',name:'Ireland'},{code:'IM',name:'Isle of Man'},{code:'IL',name:'Israel'},{code:'IT',name:'Italy'}, + {code:'JM',name:'Jamaica'},{code:'JP',name:'Japan'},{code:'JE',name:'Jersey'},{code:'JT',name:'Johnston Island'}, + {code:'JO',name:'Jordan'},{code:'KZ',name:'Kazakhstan'},{code:'KE',name:'Kenya'},{code:'KI',name:'Kiribati'}, + {code:'KW',name:'Kuwait'},{code:'KG',name:'Kyrgyzstan'},{code:'LA',name:'Laos'},{code:'LV',name:'Latvia'}, + {code:'LS',name:'Lesotho'},{code:'LY',name:'Libya'},{code:'LI',name:'Liechtenstein'},{code:'LT',name:'Lithuania'}, + {code:'LU',name:'Luxembourg'},{code:'MO',name:'Macau'},{code:'MK',name:'Macedonia [FYROM]'},{code:'MG',name:'Madagascar'}, + {code:'MW',name:'Malawi'},{code:'MY',name:'Malaysia'},{code:'MV',name:'Maldives'},{code:'ML',name:'Mali'}, + {code:'MT',name:'Malta'},{code:'MH',name:'Marshall Islands'},{code:'MQ',name:'Martinique'},{code:'MR',name:'Mauritania'}, + {code:'MU',name:'Mauritius'},{code:'YT',name:'Mayotte'},{code:'FX',name:'Metropolitan France'},{code:'MX',name:'Mexico'}, + {code:'FM',name:'Micronesia'},{code:'MI',name:'Midway Islands'},{code:'MD',name:'Moldova'},{code:'MC',name:'Monaco'}, + {code:'MN',name:'Mongolia'},{code:'ME',name:'Montenegro'},{code:'MS',name:'Montserrat'},{code:'MA',name:'Morocco'}, + {code:'MZ',name:'Mozambique'},{code:'NA',name:'Namibia'},{code:'NR',name:'Nauru'},{code:'NP',name:'Nepal'}, + {code:'NL',name:'Netherlands'},{code:'AN',name:'Netherlands Antilles'},{code:'NT',name:'Neutral Zone'}, + {code:'NC',name:'New Caledonia'},{code:'NZ',name:'New Zealand'},{code:'NI',name:'Nicaragua'},{code:'NE',name:'Niger'}, + {code:'NG',name:'Nigeria'},{code:'NU',name:'Niue'},{code:'NF',name:'Norfolk Island'},{code:'VD',name:'North Vietnam'}, + {code:'MP',name:'Northern Mariana Islands'},{code:'NO',name:'Norway'},{code:'OM',name:'Oman'}, + {code:'QO',name:'Outlying Oceania'},{code:'PC',name:'Pacific Islands Trust Territory'},{code:'PK',name:'Pakistan'}, + {code:'PW',name:'Palau'},{code:'PS',name:'Palestinian Territories'},{code:'PA',name:'Panama'},{code:'PZ',name:'Panama Canal Zone'}, + {code:'PY',name:'Paraguay'},{code:'YD',name:'People's Democratic Republic of Yemen'},{code:'PE',name:'Peru'}, + {code:'PH',name:'Philippines'},{code:'PN',name:'Pitcairn Islands'},{code:'PL',name:'Poland'},{code:'PT',name:'Portugal'}, + {code:'PR',name:'Puerto Rico'},{code:'QA',name:'Qatar'},{code:'RO',name:'Romania'},{code:'RU',name:'Russia'}, + {code:'RW',name:'Rwanda'},{code:'RE',name:'Réunion'},{code:'BL',name:'Saint Barthélemy'}, + {code:'SH',name:'Saint Helena'},{code:'KN',name:'Saint Kitts and Nevis'},{code:'LC',name:'Saint Lucia'}, + {code:'MF',name:'Saint Martin'},{code:'PM',name:'Saint Pierre and Miquelon'},{code:'VC',name:'Saint Vincent and the Grenadines'}, + {code:'WS',name:'Samoa'},{code:'SM',name:'San Marino'},{code:'SA',name:'Saudi Arabia'},{code:'SN',name:'Senegal'}, + {code:'RS',name:'Serbia'},{code:'CS',name:'Serbia and Montenegro'},{code:'SC',name:'Seychelles'},{code:'SL',name:'Sierra Leone'}, + {code:'SG',name:'Singapore'},{code:'SK',name:'Slovakia'},{code:'SI',name:'Slovenia'},{code:'SB',name:'Solomon Islands'}, + {code:'ZA',name:'South Africa'},{code:'GS',name:'South Georgia and the South Sandwich Islands'},{code:'KR',name:'South Korea'}, + {code:'ES',name:'Spain'},{code:'LK',name:'Sri Lanka'},{code:'SR',name:'Suriname'},{code:'SJ',name:'Svalbard and Jan Mayen'}, + {code:'SZ',name:'Swaziland'},{code:'SE',name:'Sweden'},{code:'CH',name:'Switzerland'}, + {code:'ST',name:'São Tomé and Príncipe'},{code:'TW',name:'Taiwan'},{code:'TJ',name:'Tajikistan'}, + {code:'TZ',name:'Tanzania'},{code:'TH',name:'Thailand'},{code:'TG',name:'Togo'},{code:'TK',name:'Tokelau'},{code:'TO',name:'Tonga'}, + {code:'TT',name:'Trinidad and Tobago'},{code:'TA',name:'Tristan da Cunha'},{code:'TN',name:'Tunisia'},{code:'TR',name:'Turkey'}, + {code:'TM',name:'Turkmenistan'},{code:'TC',name:'Turks and Caicos Islands'},{code:'TV',name:'Tuvalu'}, + {code:'UM',name:'U.S. Minor Outlying Islands'},{code:'PU',name:'U.S. Miscellaneous Pacific Islands'}, + {code:'VI',name:'U.S. Virgin Islands'},{code:'UG',name:'Uganda'},{code:'UA',name:'Ukraine'},{code:'AE',name:'United Arab Emirates'}, + {code:'GB',name:'United Kingdom'},{code:'US',name:'United States'},{code:'UY',name:'Uruguay'},{code:'UZ',name:'Uzbekistan'}, + {code:'VU',name:'Vanuatu'},{code:'VA',name:'Vatican City'},{code:'VE',name:'Venezuela'},{code:'VN',name:'Vietnam'}, + {code:'WK',name:'Wake Island'},{code:'WF',name:'Wallis and Futuna'},{code:'EH',name:'Western Sahara'},{code:'YE',name:'Yemen'}, + {code:'ZM',name:'Zambia'},{code:'AX',name:'Åland Islandscode:'} + ]