Fixed incorrect member count and capitalisation in publish options for editors/authors

no issue

- `{{format-number}}` was showing "0" when passed in an empty/nullish string when it should have been showing nothing
- used `{{if-empty}}` to fix capitalisation when the member count is missing
  - previously attempted a CSS-only fix with `:first-letter` and `text-transform: uppercase` but that broke the layout in Safari
This commit is contained in:
Kevin Ansfield 2022-05-18 09:42:44 +01:00
parent 78418e3708
commit 89f089e439
2 changed files with 9 additions and 3 deletions

View File

@ -48,12 +48,14 @@
{{format-number countFetcher.count}}
{{!-- @recipientType = none/free/paid/all/specific --}}
{{if (not-eq @recipientType "all") @recipientType}}
{{#let (if (not-eq @recipientType "all") @recipientType) as |recipientType|}}
{{if (is-empty countFetcher.count) (capitalize recipientType) recipientType}}
{{/let}}
{{#if @publishOptions.onlyDefaultNewsletter}}
{{gh-pluralize countFetcher.count "subscriber" without-count=true}}
{{gh-pluralize countFetcher.count (if (is-empty countFetcher.count) "Subscriber" "subscriber") without-count=true}}
{{else}}
{{gh-pluralize countFetcher.count "subscriber" without-count=true}}
{{gh-pluralize countFetcher.count (if (is-empty countFetcher.count) "Subscriber" "subscriber") without-count=true}}
of <span class="gh-selected-newsletter">{{@publishOptions.newsletter.name}}</span>
{{/if}}
{{/let}}

View File

@ -1,6 +1,10 @@
import {helper} from '@ember/component/helper';
export function formatNumber(number) {
if (number === '' || number === null || number === undefined) {
return;
}
return Number(number).toLocaleString();
}