mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
72590083f3
refs https://github.com/TryGhost/Team/issues/585 requires https://github.com/TryGhost/Ghost/pull/12082 When a label or status filter is selected on the members screen show a "Delete selected" option in the actions dropdown. Bulk deleted members will _not_ have any subscription data modified in Stripe, if a member should be deleted and have their subscription cancelled it's necessary to do that on a per-member basis. - updated bulk delete handling to match API - added link to bulk delete confirmation modal in members actions dropdown (only shown when label, status, or search is used) - updated testing framework for members - added label factory for easier test setup - updated `GET /members` and `DEL /members` endpoints to work with label filters - updated test selectors for easier reference in tests
143 lines
6.8 KiB
Handlebars
143 lines
6.8 KiB
Handlebars
<section class="gh-canvas">
|
|
<GhCanvasHeader class="gh-canvas-header break tablet members-header">
|
|
<h2 class="gh-canvas-title" data-test-screen-title>Members</h2>
|
|
<section class="view-actions">
|
|
<div class="view-actions-bottom-row">
|
|
<GhMembersFilter
|
|
@selectedLabel={{this.selectedLabel}}
|
|
@availableLabels={{this.availableLabels}}
|
|
@onLabelChange={{this.changeLabel}}
|
|
@onLabelAdd={{this.addLabel}}
|
|
@onLabelEdit={{this.editLabel}}
|
|
@selectedPaidParam={{this.selectedPaidParam}}
|
|
@availablePaidParams={{this.paidParams}}
|
|
@onPaidParamChange={{this.changePaidParam}}
|
|
@availableOrders={{this.availableOrders}}
|
|
@selectedOrder={{this.selectedOrder}}
|
|
@onOrderChange={{this.changeOrder}}
|
|
/>
|
|
<div class="relative gh-members-header-search">
|
|
{{svg-jar "search" class="gh-input-search-icon"}}
|
|
<GhTextInput
|
|
placeholder="Search members..."
|
|
@value={{this.searchText}}
|
|
@input={{this.search}}
|
|
class="gh-members-list-searchfield {{if this.searchText "active"}}" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="view-actions-top-row">
|
|
<span class="dropdown">
|
|
<GhDropdownButton
|
|
@dropdownName="members-actions-menu"
|
|
@classNames="gh-btn gh-btn-icon only-has-icon gh-actions-cog"
|
|
@title="Members Actions"
|
|
data-test-button="members-actions"
|
|
>
|
|
<span>
|
|
{{svg-jar "settings"}}
|
|
<span class="hidden">Actions</span>
|
|
</span>
|
|
</GhDropdownButton>
|
|
<GhDropdown
|
|
@name="members-actions-menu"
|
|
@tagName="ul"
|
|
@classNames="gh-member-actions-menu dropdown-menu dropdown-triangle-top-right"
|
|
>
|
|
<li>
|
|
<LinkTo @route="members.import" class="mr2" data-test-link="import-csv">
|
|
<span>Import members</span>
|
|
</LinkTo>
|
|
</li>
|
|
<li class="{{if this.members.length "" "disabled"}}">
|
|
{{#if this.members.length}}
|
|
<button class="mr2" {{on "click" this.exportData}}>
|
|
{{#if this.showingAll}}
|
|
<span>Export all members</span>
|
|
{{else}}
|
|
<span>Export selected members ({{this.members.length}})</span>
|
|
{{/if}}
|
|
</button>
|
|
{{else}}
|
|
<button class="mr2" disabled="true">
|
|
<span>Export selected members (0)</span>
|
|
</button>
|
|
{{/if}}
|
|
</li>
|
|
{{#if (and this.members.length this.isFiltered)}}
|
|
<li>
|
|
<button class="mr2" {{on "click" this.toggleDeleteMembersModal}} data-test-button="delete-selected">
|
|
<span class="red">Delete selected members ({{this.members.length}})</span>
|
|
</button>
|
|
</li>
|
|
{{/if}}
|
|
</GhDropdown>
|
|
</span>
|
|
<LinkTo @route="member.new" class="gh-btn gh-btn-primary" data-test-new-member-button="true"><span>New member</span></LinkTo>
|
|
</div>
|
|
</section>
|
|
</GhCanvasHeader>
|
|
|
|
{{#unless this.members.loading}}
|
|
<section class="view-container">
|
|
<section class="content-list">
|
|
<ol class="members-list gh-list {{unless this.members "no-posts"}}">
|
|
{{#if this.members}}
|
|
<li class="gh-list-row header relative">
|
|
<div class="gh-list-header" data-test-list-header>{{this.listHeader}}</div>
|
|
{{#if (feature "emailAnalytics")}}
|
|
<div class="gh-list-header gh-members-list-open-rate nowrap">Open rate</div>
|
|
{{/if}}
|
|
<div class="gh-list-header gh-members-list-geolocation nowrap">Location</div>
|
|
<div class="gh-list-header gh-members-list-subscribed-at nowrap">Created</div>
|
|
<div class="gh-list-header gh-members-list-chevron gh-list-cellwidth-chevron"></div>
|
|
</li>
|
|
<VerticalCollection @items={{this.members}} @key="id" @containerSelector=".gh-main" @estimateHeight={{69}} @staticHeight={{true}} @bufferSize={{20}} as |member|>
|
|
<GhMembersListItem
|
|
@member={{member}}
|
|
@data-test-member={{member.id}}
|
|
/>
|
|
</VerticalCollection>
|
|
{{else}}
|
|
<li class="no-posts-box" data-test-no-members>
|
|
<div class="no-posts">
|
|
{{svg-jar "members-placeholder" class="gh-members-placeholder"}}
|
|
{{#if this.showingAll}}
|
|
<h3>No members yet</h3>
|
|
<GhMembersNoMembers @afterCreate={{this.refreshData}} />
|
|
{{else}}
|
|
<h3>No members match the current filter</h3>
|
|
{{/if}}
|
|
</div>
|
|
</li>
|
|
{{/if}}
|
|
</ol>
|
|
</section>
|
|
</section>
|
|
{{else}}
|
|
<div class="gh-content">
|
|
<GhLoadingSpinner />
|
|
</div>
|
|
{{/unless}}
|
|
</section>
|
|
|
|
{{outlet}}
|
|
|
|
{{#if this.showDeleteMembersModal}}
|
|
<GhFullscreenModal
|
|
@modal="delete-members"
|
|
@model={{hash memberCount=this.members.length}}
|
|
@confirm={{this.deleteMembers}}
|
|
@close={{this.toggleDeleteMembersModal}}
|
|
@modifier="action wide"
|
|
/>
|
|
{{/if}}
|
|
|
|
{{#if this.showLabelModal}}
|
|
<GhFullscreenModal
|
|
@modal="members-label-form"
|
|
@model={{this.labelModalData}}
|
|
@close={{this.toggleLabelModal}}
|
|
@modifier="action wide"
|
|
/>
|
|
{{/if}} |