mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
Added currency grouping
This commit is contained in:
parent
5491ee0d55
commit
7744a78594
@ -166,7 +166,7 @@
|
|||||||
{{one-way-select this.selectedCurrency
|
{{one-way-select this.selectedCurrency
|
||||||
id="currency"
|
id="currency"
|
||||||
name="currency"
|
name="currency"
|
||||||
options=(readonly this.currencies)
|
options=(readonly this.allCurrencies)
|
||||||
optionValuePath="value"
|
optionValuePath="value"
|
||||||
optionLabelPath="label"
|
optionLabelPath="label"
|
||||||
update=(action "setStripePlansCurrency")
|
update=(action "setStripePlansCurrency")
|
||||||
|
@ -13,7 +13,9 @@ export default Component.extend({
|
|||||||
ajax: service(),
|
ajax: service(),
|
||||||
settings: service(),
|
settings: service(),
|
||||||
|
|
||||||
|
topCurrencies: null,
|
||||||
currencies: null,
|
currencies: null,
|
||||||
|
allCurrencies: null,
|
||||||
stripePlanInvalidAmount: false,
|
stripePlanInvalidAmount: false,
|
||||||
_scratchStripeYearlyAmount: null,
|
_scratchStripeYearlyAmount: null,
|
||||||
_scratchStripeMonthlyAmount: null,
|
_scratchStripeMonthlyAmount: null,
|
||||||
@ -67,13 +69,35 @@ export default Component.extend({
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.set('currencies', currencies.map((currency) => {
|
|
||||||
|
const noOfTopCurrencies = 5;
|
||||||
|
this.set('topCurrencies', currencies.slice(0, noOfTopCurrencies).map((currency) => {
|
||||||
return {
|
return {
|
||||||
value: currency.isoCode.toLowerCase(),
|
value: currency.isoCode.toLowerCase(),
|
||||||
label: `${currency.isoCode} - ${currency.name}`,
|
label: `${currency.isoCode} - ${currency.name}`,
|
||||||
isoCode: currency.isoCode
|
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')) {
|
if (this.get('stripeConnectAccountId')) {
|
||||||
this.set('membersStripeOpen', false);
|
this.set('membersStripeOpen', false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
export const currencies = [
|
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: 'AED', name: 'United Arab Emirates dirham'},
|
||||||
{isoCode: 'AFN', name: 'Afghan afghani'},
|
{isoCode: 'AFN', name: 'Afghan afghani'},
|
||||||
{isoCode: 'ALL', name: 'Albanian lek'},
|
{isoCode: 'ALL', name: 'Albanian lek'},
|
||||||
@ -6,7 +11,6 @@ export const currencies = [
|
|||||||
{isoCode: 'ANG', name: 'Netherlands Antillean guilder'},
|
{isoCode: 'ANG', name: 'Netherlands Antillean guilder'},
|
||||||
{isoCode: 'AOA', name: 'Angolan kwanza'},
|
{isoCode: 'AOA', name: 'Angolan kwanza'},
|
||||||
{isoCode: 'ARS', name: 'Argentine peso'},
|
{isoCode: 'ARS', name: 'Argentine peso'},
|
||||||
{isoCode: 'AUD', name: 'Austrialian dollar'},
|
|
||||||
{isoCode: 'AWG', name: 'Aruban florin'},
|
{isoCode: 'AWG', name: 'Aruban florin'},
|
||||||
{isoCode: 'AZN', name: 'Azerbaijani manat'},
|
{isoCode: 'AZN', name: 'Azerbaijani manat'},
|
||||||
{isoCode: 'BAM', name: 'Bosnia and Herzegovina convertible mark'},
|
{isoCode: 'BAM', name: 'Bosnia and Herzegovina convertible mark'},
|
||||||
@ -20,7 +24,6 @@ export const currencies = [
|
|||||||
{isoCode: 'BSD', name: 'Bahamian dollar'},
|
{isoCode: 'BSD', name: 'Bahamian dollar'},
|
||||||
{isoCode: 'BWP', name: 'Botswana pula'},
|
{isoCode: 'BWP', name: 'Botswana pula'},
|
||||||
{isoCode: 'BZD', name: 'Belize dollar'},
|
{isoCode: 'BZD', name: 'Belize dollar'},
|
||||||
{isoCode: 'CAD', name: 'Canadian dollar'},
|
|
||||||
{isoCode: 'CDF', name: 'Congolese franc'},
|
{isoCode: 'CDF', name: 'Congolese franc'},
|
||||||
{isoCode: 'CHF', name: 'Swiss franc'},
|
{isoCode: 'CHF', name: 'Swiss franc'},
|
||||||
{isoCode: 'CNY', name: 'Chinese yuan'},
|
{isoCode: 'CNY', name: 'Chinese yuan'},
|
||||||
@ -33,10 +36,8 @@ export const currencies = [
|
|||||||
{isoCode: 'DZD', name: 'Algerian dinar'},
|
{isoCode: 'DZD', name: 'Algerian dinar'},
|
||||||
{isoCode: 'EGP', name: 'Egyptian pound'},
|
{isoCode: 'EGP', name: 'Egyptian pound'},
|
||||||
{isoCode: 'ETB', name: 'Ethiopian birr'},
|
{isoCode: 'ETB', name: 'Ethiopian birr'},
|
||||||
{isoCode: 'EUR', name: 'Euro'},
|
|
||||||
{isoCode: 'FJD', name: 'Fiji dollar'},
|
{isoCode: 'FJD', name: 'Fiji dollar'},
|
||||||
{isoCode: 'FKP', name: 'Falkland Islands pound'},
|
{isoCode: 'FKP', name: 'Falkland Islands pound'},
|
||||||
{isoCode: 'GBP', name: 'Pound sterling'},
|
|
||||||
{isoCode: 'GEL', name: 'Georgian lari'},
|
{isoCode: 'GEL', name: 'Georgian lari'},
|
||||||
{isoCode: 'GIP', name: 'Gibraltar pound'},
|
{isoCode: 'GIP', name: 'Gibraltar pound'},
|
||||||
{isoCode: 'GMD', name: 'Gambian dalasi'},
|
{isoCode: 'GMD', name: 'Gambian dalasi'},
|
||||||
@ -110,7 +111,6 @@ export const currencies = [
|
|||||||
{isoCode: 'TWD', name: 'New Taiwan dollar'},
|
{isoCode: 'TWD', name: 'New Taiwan dollar'},
|
||||||
{isoCode: 'TZS', name: 'Tanzanian shilling'},
|
{isoCode: 'TZS', name: 'Tanzanian shilling'},
|
||||||
{isoCode: 'UAH', name: 'Ukrainian hryvnia'},
|
{isoCode: 'UAH', name: 'Ukrainian hryvnia'},
|
||||||
{isoCode: 'USD', name: 'United States dollar'},
|
|
||||||
{isoCode: 'UYU', name: 'Uruauayan peso'},
|
{isoCode: 'UYU', name: 'Uruauayan peso'},
|
||||||
{isoCode: 'UZS', name: 'Uzbekistan som'},
|
{isoCode: 'UZS', name: 'Uzbekistan som'},
|
||||||
{isoCode: 'WST', name: 'Samoan tala'},
|
{isoCode: 'WST', name: 'Samoan tala'},
|
||||||
|
Loading…
Reference in New Issue
Block a user