From 3f0f3f1b68463fb0d0cc781544d9afbcefed1cf4 Mon Sep 17 00:00:00 2001 From: Peter Zimon Date: Wed, 8 Jul 2020 15:51:12 +0200 Subject: [PATCH] Added number formatting to members import no refs. - added number formatting to all the screens of members import --- .../app/components/gh-members-import-table.hbs | 2 +- .../admin/app/components/modal-import-members.hbs | 10 +++++----- .../admin/app/services/member-import-validator.js | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ghost/admin/app/components/gh-members-import-table.hbs b/ghost/admin/app/components/gh-members-import-table.hbs index 3161f89529..3b4156f899 100644 --- a/ghost/admin/app/components/gh-members-import-table.hbs +++ b/ghost/admin/app/components/gh-members-import-table.hbs @@ -4,7 +4,7 @@ Field
- Data ({{this.currentRecord}} of {{this.allRecords}}) + Data ({{format-number this.currentRecord}} of {{format-number this.allRecords}})
{{svg-jar "arrow-left" class="w3 h3 fill-middarkgrey" }} {{svg-jar "arrow-right" class="w3 h3 fill-middarkgrey" }} diff --git a/ghost/admin/app/components/modal-import-members.hbs b/ghost/admin/app/components/modal-import-members.hbs index 4a723041ce..2496e8f2b9 100644 --- a/ghost/admin/app/components/modal-import-members.hbs +++ b/ghost/admin/app/components/modal-import-members.hbs @@ -18,11 +18,11 @@
-

{{this.importResponse.imported.count}}

+

{{format-number this.importResponse.imported.count}}

{{pluralize this.importResponse.imported.count "Member" without-count=true}} added

-

{{this.importResponse.invalid.count}}

+

{{format-number this.importResponse.invalid.count}}

{{pluralize this.importResponse.invalid.count "Error" without-count=true}}

@@ -33,11 +33,11 @@
{{svg-jar "warning" class="w5 h5 fill-red nudge-top--3 mr3"}}
-

{{pluralize this.importResponse.invalid.count "member"}} were skipped due to the following errors:

+

{{format-number this.importResponse.invalid.count}} {{pluralize this.importResponse.invalid.count "member" without-count=true}} were skipped due to the following errors:

{{#if this.config.enableDeveloperExperiments}}
    {{#each this.importResponse.invalid.errors as |error|}} -
  • {{error.message}} ({{error.count}})
  • +
  • {{error.message}} ({{format-number error.count}})
  • {{/each}}
{{/if}} @@ -153,7 +153,7 @@ Start over {{/if}} {{else}} diff --git a/ghost/admin/app/services/member-import-validator.js b/ghost/admin/app/services/member-import-validator.js index bcad291389..58be701757 100644 --- a/ghost/admin/app/services/member-import-validator.js +++ b/ghost/admin/app/services/member-import-validator.js @@ -1,8 +1,8 @@ import MemberImportError from 'ghost-admin/errors/member-import-error'; import Service, {inject as service} from '@ember/service'; import validator from 'validator'; +import {formatNumber} from 'ghost-admin/helpers/format-number'; import {isEmpty} from '@ember/utils'; -import {pluralize} from 'ember-inflector'; export default Service.extend({ ajax: service(), @@ -32,8 +32,8 @@ export default Service.extend({ if (!this.membersUtils.isStripeEnabled) { validationErrors.push(new MemberImportError({ - message: 'Missing stripe connection', - context: (pluralize(totalCount, 'Stripe customer')) + ` won't be imported. You need to connect to Stripe to import stripe customers.`, + message: `Missing stripe connection (${formatNumber(totalCount)})`, + context: `Stripe customers won't be imported. You need to connect to Stripe to import stripe customers.`, type: 'warning' })); } else { @@ -49,7 +49,7 @@ export default Service.extend({ if (duplicateCount) { validationErrors.push(new MemberImportError({ - message: `Duplicate Stripe ID (${duplicateCount})`, + message: `Duplicate Stripe ID (${formatNumber(duplicateCount)})`, type: 'warning' })); } @@ -65,14 +65,14 @@ export default Service.extend({ if (invalidCount) { // @TODO: Remove error from displayed errors validationErrors.push(new MemberImportError({ - message: `Invalid email address (${invalidCount})`, + message: `Invalid email address (${formatNumber(invalidCount)})`, type: 'warning' })); } if (emptyCount) { validationErrors.push(new MemberImportError({ - message: `Missing email address (${emptyCount})`, + message: `Missing email address (${formatNumber(emptyCount)})`, type: 'warning' })); } @@ -80,7 +80,7 @@ export default Service.extend({ if (duplicateCount) { // @TODO: Remove error from displayed errors validationErrors.push(new MemberImportError({ - message: `Duplicate email address (${duplicateCount})`, + message: `Duplicate email address (${formatNumber(duplicateCount)})`, type: 'warning' })); }