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>
|
</div>
|
||||||
</LinkTo>
|
</LinkTo>
|
||||||
{{#if (feature "membersTableStatus")}}
|
{{#if (feature "membersTableStatus")}}
|
||||||
{{!-- One line: Free tier, or premium tier if there is only one premium tier --}}
|
{{#if this.hasMultipleProducts}}
|
||||||
{{!-- <LinkTo @route="member" @model={{@member}} class="gh-list-data">
|
<LinkTo @route="member" @model={{@member}} class="gh-list-data">
|
||||||
<div>Free</div>
|
{{#if (not (is-empty @member.status))}}
|
||||||
</LinkTo>--}}
|
<span>{{capitalize @member.status}}</span>
|
||||||
|
{{else}}
|
||||||
{{!-- Two lines: Premium tier if there are multiple premium tiers --}}
|
<span class="midlightgrey">-</span>
|
||||||
{{!-- <LinkTo @route="member" @model={{@member}} class="gh-list-data">
|
{{/if}}
|
||||||
<div>Paid</div>
|
<div class="midgrey">{{this.products}}</div>
|
||||||
<div class="midgrey">Bronze</div>
|
</LinkTo>
|
||||||
</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}}
|
||||||
{{#if @newsletterEnabled}}
|
{{#if @newsletterEnabled}}
|
||||||
{{#if (feature "emailAnalytics")}}
|
{{#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() {
|
get filterColumns() {
|
||||||
const defaultColumns = ['name', 'email', 'created_at'];
|
const defaultColumns = ['name', 'email', 'created_at'];
|
||||||
|
if (this.feature.get('membersTableStatus')) {
|
||||||
|
defaultColumns.push('status', 'product');
|
||||||
|
}
|
||||||
const availableFilters = this.filters.length ? this.filters : this.softFilters;
|
const availableFilters = this.filters.length ? this.filters : this.softFilters;
|
||||||
return availableFilters.map((filter) => {
|
return availableFilters.map((filter) => {
|
||||||
return filter.type;
|
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')}'`]
|
extraFilters: [`created_at:<='${moment.utc(this._startDate).format('YYYY-MM-DD HH:mm:ss')}'`]
|
||||||
});
|
});
|
||||||
const order = orderParam ? `${orderParam} desc` : `created_at desc`;
|
const order = orderParam ? `${orderParam} desc` : `created_at desc`;
|
||||||
const includes = ['labels'];
|
const includes = ['labels', 'products'];
|
||||||
if (this.includeProductQuery()) {
|
|
||||||
includes.push('products');
|
|
||||||
}
|
|
||||||
query = Object.assign({
|
query = Object.assign({
|
||||||
include: includes.join(','),
|
include: includes.join(','),
|
||||||
order,
|
order,
|
||||||
|
|
Loading…
Add table
Reference in a new issue