Ghost/ghost/admin/app/components/gh-members-recipient-select.hbs
Kevin Ansfield bc5ddd9921 Resolved linter errors in <GhMembersRecipientSelect>
no issue

- fixed duplicate `id` attribute on the specific people checkbox
- switched toggle behaviour from a click event on the surrounding div to a change event on the checkbox
  - the surrounding `<label>` has appropriate `for` attribute so it acts as the click-to-change target
- added `aria-label` attributes to the checkboxes because the label element we're using does not surround any content that labels the checkbox
2022-03-11 11:06:13 +00:00

75 lines
3.0 KiB
Handlebars

<div class="gh-publishmenu-send-to-option">
<p>Free members <span class="gh-publishmenu-emailcount">{{this.freeMemberCountLabel}}</span></p>
<div class="for-switch x-small {{if @disabled "disabled"}}">
<label class="switch" for="send-email-to-free">
<input
id="send-email-to-free"
type="checkbox"
class="gh-input post-settings-featured"
checked={{this.isFreeChecked}}
disabled={{@disabled}}
aria-label="Free members toggle"
{{on "change" (fn this.toggleFilter "status:free")}}
data-test-checkbox="free-members"
>
<span class="input-toggle-component"></span>
</label>
</div>
</div>
{{#if this.isPaidAvailable}}
<div class="gh-publishmenu-send-to-option">
<p>Paid members <span class="gh-publishmenu-emailcount">{{this.paidMemberCountLabel}}</span></p>
<div class="for-switch x-small {{if @disabled "disabled"}}">
<label class="switch" for="send-email-to-paid">
<input
id="send-email-to-paid"
type="checkbox"
class="gh-input post-settings-featured"
checked={{this.isPaidChecked}}
disabled={{@disabled}}
aria-label="Paid members toggle"
{{on "change" (fn this.toggleFilter "status:-free")}}
data-test-checkbox="paid-members"
>
<span class="input-toggle-component"></span>
</label>
</div>
</div>
{{/if}}
{{#if this.specificOptions}}
<div class="gh-publishmenu-send-to-option">
<p>Specific people</p>
<div class="for-switch x-small {{if @disabled "disabled"}}">
<label class="switch" for="send-email-to-specific">
<input
id="send-email-to-specific"
type="checkbox"
class="gh-input post-settings-featured"
checked={{this.isSpecificChecked}}
disabled={{@disabled}}
aria-label="Specific people toggle"
{{on "change" this.toggleSpecificFilter}}
data-test-checkbox="paid-members"
>
<span class="input-toggle-component"></span>
</label>
</div>
</div>
{{#if this.isSpecificChecked}}
<GhTokenInput
@class="select-members select-members-recipient"
@options={{this.specificOptions}}
@selected={{this.selectedSpecificOptions}}
@disabled={{@disabled}}
@searchMessage="All labels selected"
@optionsComponent="power-select/options"
@allowCreation={{false}}
@renderInPlace={{true}}
@onChange={{this.selectSpecificOptions}}
as |option|
>
{{option.name}}
</GhTokenInput>
{{/if}}
{{/if}}