mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Added status/tier as default column for members index table
refs https://github.com/TryGhost/Team/issues/1035 - provides context on member's tier/status on default index table - removes extra membership tier column as information is captured in status column
This commit is contained in:
parent
82d6d38b3f
commit
987ec3f742
3 changed files with 43 additions and 14 deletions
|
@ -23,16 +23,24 @@
|
|||
</div>
|
||||
</LinkTo>
|
||||
{{#if (feature "membersTableStatus")}}
|
||||
{{!-- One line: Free tier, or premium tier if there is only one premium tier --}}
|
||||
{{!-- <LinkTo @route="member" @model={{@member}} class="gh-list-data">
|
||||
<div>Free</div>
|
||||
</LinkTo>--}}
|
||||
|
||||
{{!-- Two lines: Premium tier if there are multiple premium tiers --}}
|
||||
{{!-- <LinkTo @route="member" @model={{@member}} class="gh-list-data">
|
||||
<div>Paid</div>
|
||||
<div class="midgrey">Bronze</div>
|
||||
</LinkTo> --}}
|
||||
{{#if this.hasMultipleProducts}}
|
||||
<LinkTo @route="member" @model={{@member}} class="gh-list-data">
|
||||
{{#if (not (is-empty @member.status))}}
|
||||
<span>{{capitalize @member.status}}</span>
|
||||
{{else}}
|
||||
<span class="midlightgrey">-</span>
|
||||
{{/if}}
|
||||
<div class="midgrey">{{this.products}}</div>
|
||||
</LinkTo>
|
||||
{{else}}
|
||||
<LinkTo @route="member" @model={{@member}} class="gh-list-data" data-test-table-data="status">
|
||||
{{#if (not (is-empty @member.status))}}
|
||||
<span>{{capitalize @member.status}}</span>
|
||||
{{else}}
|
||||
<span class="midlightgrey">-</span>
|
||||
{{/if}}
|
||||
</LinkTo>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if @newsletterEnabled}}
|
||||
{{#if (feature "emailAnalytics")}}
|
||||
|
|
20
ghost/admin/app/components/gh-members-list-item.js
Normal file
20
ghost/admin/app/components/gh-members-list-item.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
import Component from '@glimmer/component';
|
||||
import {get} from '@ember/object';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default class GhMembersListItem extends Component {
|
||||
@service store;
|
||||
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
}
|
||||
|
||||
get hasMultipleProducts() {
|
||||
return this.store.peekAll('product')?.length > 1;
|
||||
}
|
||||
|
||||
get products() {
|
||||
const productData = get(this.args.member, 'products') || [];
|
||||
return productData.map(product => product.name).join(', ');
|
||||
}
|
||||
}
|
|
@ -158,6 +158,9 @@ export default class MembersController extends Controller {
|
|||
|
||||
get filterColumns() {
|
||||
const defaultColumns = ['name', 'email', 'created_at'];
|
||||
if (this.feature.get('membersTableStatus')) {
|
||||
defaultColumns.push('status', 'product');
|
||||
}
|
||||
const availableFilters = this.filters.length ? this.filters : this.softFilters;
|
||||
return availableFilters.map((filter) => {
|
||||
return filter.type;
|
||||
|
@ -401,10 +404,8 @@ export default class MembersController extends Controller {
|
|||
extraFilters: [`created_at:<='${moment.utc(this._startDate).format('YYYY-MM-DD HH:mm:ss')}'`]
|
||||
});
|
||||
const order = orderParam ? `${orderParam} desc` : `created_at desc`;
|
||||
const includes = ['labels'];
|
||||
if (this.includeProductQuery()) {
|
||||
includes.push('products');
|
||||
}
|
||||
const includes = ['labels', 'products'];
|
||||
|
||||
query = Object.assign({
|
||||
include: includes.join(','),
|
||||
order,
|
||||
|
|
Loading…
Add table
Reference in a new issue