Ghost/ghost/admin/app/components/modal-delete-members.hbs
Kevin Ansfield eee84ab5f7 Added first pass bulk members delete confirmation and results display
no issue

- display a confirmation modal when bulk deleting members
- hit the `DELETE /members/?all=true` endpoint when confirming
- show counts of members deleted/skipped
- fix selection reset when leaving edit mode
2020-06-19 18:14:41 +01:00

69 lines
2.8 KiB
Handlebars

<header class="modal-header" data-test-modal="delete-members">
<h1>Are you sure you want to delete these members?</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="delete-unconfirmed">
<p>
You're about to delete
<strong data-test-text="delete-count">{{pluralize this.model.memberCount "member"}}</strong>.
This is permanent! We warned you, k?
</p>
</div>
{{else}}
<div class="modal-body bg-whitegray-l2 ba b--whitegrey br3 pa4" data-test-state="delete-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="delete-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">
<span class="fw6" data-test-text="deleted-count">{{pluralize this.response.deleted.count "member"}}</span>
deleted
</p>
</div>
{{#if this.response.invalid.count}}
<div class="flex items-start mt2" data-test-bulk-delete-errors>
{{svg-jar "warning" class="w4 h4 fill-red mr2 nudge-top--3"}}
<div>
<p class="ma0 pa0">
<span class="fw5" data-test-text="invalid-count">{{pluralize this.response.invalid.count "member"}}</span>
skipped
</p>
{{#each this.response.invalid.errors as |error|}}
<p class="gh-members-import-errordetail">{{error.message}} <span class="fw6">{{error.count}}</span></p>
{{/each}}
</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
@buttonText="Delete"
@successText="Deleted"
@task={{this.deleteMembersTask}}
@class="gh-btn gh-btn-red gh-btn-icon"
data-test-button="confirm"
/>
{{else}}
<button {{action "closeModal"}} class="gh-btn" data-test-button="close-modal">
<span>Close</span>
</button>
{{/if}}
</div>