Ghost/ghost/admin/app/components/members/list-item-column.hbs
Simon Backx 7c824556c2
Added new members filters and refactored filters (#15667)
fixes https://github.com/TryGhost/Team/issues/2112

- Removed a bit of duplicate code across templates and components that was used to handle filters
- Updated filter objects to contain information about the filter
- Added resource filters that are able to select a single resource, which can be used in columns
- Filters can now define columns by themselves. Not all columns already make use of this functionality, but we can move those over later (cleanup: https://github.com/TryGhost/Team/issues/2133)
- The filter definitions became quite long. We should move them to separate files in the future: https://github.com/TryGhost/Team/issues/2134
- Filters can now have custom NQL parsing
- Improved support for parsing recursive or grouped NQL queries
- Added support for filtering members by feedback
2022-10-21 17:18:00 +02:00

99 lines
4.6 KiB
Handlebars

{{#if (eq this.columnName 'label')}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data wrap middarkgrey f8" data-test-table-data={{this.columnName}}>
<span class="gh-members-list-labels">{{this.labels}}</span>
</LinkTo>
{{else if (eq this.columnName 'tier')}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data wrap middarkgrey f8" data-test-table-data={{this.columnName}}>
<span class="gh-members-list-labels">{{this.tiers}}</span>
</LinkTo>
{{else if (eq this.columnName 'last_seen_at')}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8" data-test-table-data={{this.columnName}}>
{{#if (not (is-empty @member.lastSeenAtUTC))}}
{{moment-format (moment-site-tz @member.lastSeenAtUTC) "DD MMM YYYY"}}
<div class="midlightgrey gh-members-list-subscribed-moment">{{moment-from-now @member.lastSeenAtUTC}}</div>
{{else}}
<span class="midlightgrey">-</span>
{{/if}}
</LinkTo>
{{else if (eq this.columnName 'email_count')}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8" data-test-table-data={{this.columnName}}>
{{#if (not (is-empty @member.emailCount))}}
<span>{{@member.emailCount}}</span>
{{else}}
<span class="midlightgrey">-</span>
{{/if}}
</LinkTo>
{{else if (eq this.columnName 'email_opened_count')}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8" data-test-table-data={{this.columnName}}>
{{#if (not (is-empty @member.emailOpenedCount))}}
<span>{{@member.emailOpenedCount}}</span>
{{else}}
<span class="midlightgrey">-</span>
{{/if}}
</LinkTo>
{{else if (eq this.columnName 'subscribed')}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8" data-test-table-data={{this.columnName}}>
{{#if (not (is-empty @member.subscribed))}}
<span>{{if @member.subscribed "Yes" "No"}}</span>
{{else}}
<span class="midlightgrey">-</span>
{{/if}}
</LinkTo>
{{else if (eq this.columnName 'subscriptions.status')}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8" data-test-table-data={{this.columnName}}>
{{#if (not (is-empty this.mostRecentSubscription.status))}}
<span>{{capitalize this.mostRecentSubscription.status}}</span>
{{else}}
<span class="midlightgrey">-</span>
{{/if}}
</LinkTo>
{{else if (eq this.columnName 'subscriptions.plan_interval')}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8" data-test-table-data={{this.columnName}}>
{{#if (not (is-empty this.mostRecentSubscription.price.interval))}}
<span>{{capitalize this.mostRecentSubscription.price.interval}}</span>
{{else}}
<span class="midlightgrey">-</span>
{{/if}}
</LinkTo>
{{else if (eq this.columnName 'subscriptions.start_date')}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8" data-test-table-data={{this.columnName}}>
{{#if (not (is-empty this.mostRecentSubscription.start_date))}}
{{moment-format (moment-site-tz this.mostRecentSubscription.start_date) "DD MMM YYYY"}}
<div class="midlightgrey gh-members-list-subscribed-moment">{{moment-from-now this.mostRecentSubscription.start_date}}</div>
{{else}}
<span class="midlightgrey">-</span>
{{/if}}
</LinkTo>
{{else if (eq this.columnName 'subscriptions.current_period_end')}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8" data-test-table-data={{this.columnName}}>
{{#if (not (is-empty this.mostRecentSubscription.current_period_end))}}
{{moment-format (moment-site-tz this.mostRecentSubscription.current_period_end) "DD MMM YYYY"}}
<div class="midlightgrey gh-members-list-subscribed-moment">{{moment-from-now this.mostRecentSubscription.current_period_end}}</div>
{{else}}
<span class="midlightgrey">-</span>
{{/if}}
</LinkTo>
{{else}}
<LinkTo @route="member" @model={{@member}} class="gh-list-data middarkgrey f8" data-test-table-data={{this.columnName}}>
{{#if this.columnValue}}
<div class={{this.columnValue.class}}>
{{#if this.columnValue.icon}}
{{svg-jar this.columnValue.icon}}
{{/if}}
<span>{{this.columnValue.text}}</span>
</div>
{{else}}
<span class="midlightgrey">-</span>
{{/if}}
</LinkTo>
{{/if}}