diff --git a/ghost/admin/app/components/gh-members-payments-setting.hbs b/ghost/admin/app/components/gh-members-payments-setting.hbs index 3f262c9ecd..7becaf5a56 100644 --- a/ghost/admin/app/components/gh-members-payments-setting.hbs +++ b/ghost/admin/app/components/gh-members-payments-setting.hbs @@ -166,7 +166,7 @@ {{one-way-select this.selectedCurrency id="currency" name="currency" - options=(readonly this.currencies) + options=(readonly this.allCurrencies) optionValuePath="value" optionLabelPath="label" update=(action "setStripePlansCurrency") diff --git a/ghost/admin/app/components/gh-members-payments-setting.js b/ghost/admin/app/components/gh-members-payments-setting.js index 9cb55fb990..1d57a46555 100644 --- a/ghost/admin/app/components/gh-members-payments-setting.js +++ b/ghost/admin/app/components/gh-members-payments-setting.js @@ -13,7 +13,9 @@ export default Component.extend({ ajax: service(), settings: service(), + topCurrencies: null, currencies: null, + allCurrencies: null, stripePlanInvalidAmount: false, _scratchStripeYearlyAmount: null, _scratchStripeMonthlyAmount: null, @@ -67,13 +69,35 @@ export default Component.extend({ init() { this._super(...arguments); - this.set('currencies', currencies.map((currency) => { + + const noOfTopCurrencies = 5; + this.set('topCurrencies', currencies.slice(0, noOfTopCurrencies).map((currency) => { return { value: currency.isoCode.toLowerCase(), label: `${currency.isoCode} - ${currency.name}`, isoCode: currency.isoCode }; })); + + this.set('currencies', currencies.slice(noOfTopCurrencies, currencies.length).map((currency) => { + return { + value: currency.isoCode.toLowerCase(), + label: `${currency.isoCode} - ${currency.name}`, + isoCode: currency.isoCode + }; + })); + + this.set('allCurrencies', [ + { + groupName: '—', + options: this.get('topCurrencies') + }, + { + groupName: '—', + options: this.get('currencies') + } + ]); + if (this.get('stripeConnectAccountId')) { this.set('membersStripeOpen', false); } else { diff --git a/ghost/admin/app/utils/currency.js b/ghost/admin/app/utils/currency.js index 8ae33d4755..b2c724ccef 100644 --- a/ghost/admin/app/utils/currency.js +++ b/ghost/admin/app/utils/currency.js @@ -1,4 +1,9 @@ export const currencies = [ + {isoCode: 'USD', name: 'United States dollar'}, + {isoCode: 'EUR', name: 'Euro'}, + {isoCode: 'GBP', name: 'Pound sterling'}, + {isoCode: 'AUD', name: 'Austrialian dollar'}, + {isoCode: 'CAD', name: 'Canadian dollar'}, {isoCode: 'AED', name: 'United Arab Emirates dirham'}, {isoCode: 'AFN', name: 'Afghan afghani'}, {isoCode: 'ALL', name: 'Albanian lek'}, @@ -6,7 +11,6 @@ export const currencies = [ {isoCode: 'ANG', name: 'Netherlands Antillean guilder'}, {isoCode: 'AOA', name: 'Angolan kwanza'}, {isoCode: 'ARS', name: 'Argentine peso'}, - {isoCode: 'AUD', name: 'Austrialian dollar'}, {isoCode: 'AWG', name: 'Aruban florin'}, {isoCode: 'AZN', name: 'Azerbaijani manat'}, {isoCode: 'BAM', name: 'Bosnia and Herzegovina convertible mark'}, @@ -20,7 +24,6 @@ export const currencies = [ {isoCode: 'BSD', name: 'Bahamian dollar'}, {isoCode: 'BWP', name: 'Botswana pula'}, {isoCode: 'BZD', name: 'Belize dollar'}, - {isoCode: 'CAD', name: 'Canadian dollar'}, {isoCode: 'CDF', name: 'Congolese franc'}, {isoCode: 'CHF', name: 'Swiss franc'}, {isoCode: 'CNY', name: 'Chinese yuan'}, @@ -33,10 +36,8 @@ export const currencies = [ {isoCode: 'DZD', name: 'Algerian dinar'}, {isoCode: 'EGP', name: 'Egyptian pound'}, {isoCode: 'ETB', name: 'Ethiopian birr'}, - {isoCode: 'EUR', name: 'Euro'}, {isoCode: 'FJD', name: 'Fiji dollar'}, {isoCode: 'FKP', name: 'Falkland Islands pound'}, - {isoCode: 'GBP', name: 'Pound sterling'}, {isoCode: 'GEL', name: 'Georgian lari'}, {isoCode: 'GIP', name: 'Gibraltar pound'}, {isoCode: 'GMD', name: 'Gambian dalasi'}, @@ -110,7 +111,6 @@ export const currencies = [ {isoCode: 'TWD', name: 'New Taiwan dollar'}, {isoCode: 'TZS', name: 'Tanzanian shilling'}, {isoCode: 'UAH', name: 'Ukrainian hryvnia'}, - {isoCode: 'USD', name: 'United States dollar'}, {isoCode: 'UYU', name: 'Uruauayan peso'}, {isoCode: 'UZS', name: 'Uzbekistan som'}, {isoCode: 'WST', name: 'Samoan tala'},