Ghost/ghost/admin/app/components/modal-remove-label-members.hbs
Rishabh e5e68ff55b Fixed label bulk action error on filtering UI
no refs

- when a site has no labels, the bulk action on labels - add/remove - was throwing an error
- fixes the bug and adds disabled state for add/remove label bulk action UI
2021-09-10 10:19:25 +05:30

66 lines
2.7 KiB
Handlebars

<header class="modal-header" data-test-modal="remove-label-members">
<h1>Remove Label</h1>
</header>
<a class="close" href="" role="button" title="Close" {{action "closeModal"}}>{{svg-jar "close"}}<span class="hidden">Close</span></a>
{{#if (not this.confirmed)}}
<div class="modal-body" data-test-state="add-label-unconfirmed">
<GhMemberSingleLabelInput @onChange={{action "setLabel"}} @triggerId="label-input" data-test-input="" />
<p class="mt2 ml1">
Will be removed from the currently selected <span class="fw6" data-test-text="member-count">{{gh-pluralize this.model.memberCount "member"}}</span>
</p>
</div>
{{else}}
<div class="gh-content-box pa" data-test-state="remove-complete">
{{#if this.error}}
<div class="flex items-center">
{{svg-jar "warning" class="w4 h4 fill-red mr2 nudge-top--3"}}
<div>
<p class="ma0 pa0">
<span class="fw5" data-test-text="remove-error">{{this.error}}</span>
</p>
</div>
</div>
{{else}}
<div class="flex items-center">
{{svg-jar "check-circle" class="w4 h4 stroke-green mr2"}}
<p class="ma0 pa0">
Label removed from <span class="fw6" data-test-text="remove-count">{{gh-pluralize this.response.stats.successful "member"}}</span>
successfully
</p>
</div>
{{#if this.response.stats.unsuccessful}}
<div class="flex items-start mt2" data-test-bulk-label-add-errors>
{{svg-jar "warning" class="w4 h4 fill-red mr2 nudge-top--3"}}
<div>
<p class="ma0 pa0">
Failed to remove label from <span class="fw5" data-test-text="invalid-count">{{gh-pluralize this.response.stats.unsuccessful "member"}}</span>
</p>
</div>
</div>
{{/if}}
{{/if}}
</div>
{{/if}}
<div class="modal-footer">
{{#if (not this.confirmed)}}
<button {{action "closeModal"}} class="gh-btn" data-test-button="cancel">
<span>Cancel</span>
</button>
<GhTaskButton
@disabled={{this.isDisabled}}
@buttonText="Remove Label"
@successText="Removed"
@task={{this.removeLabelTask}}
@class="gh-btn gh-btn-red gh-btn-icon"
data-test-button="confirm"
/>
{{else}}
<button {{action "closeModal"}} class="gh-btn gh-btn-black" data-test-button="close-modal">
<span>Close</span>
</button>
{{/if}}
</div>