mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-01 23:37:43 +03:00
Added latest 5 newsletters list to labs dashboard
no issue - basic functionality added, prep for dashboard re-organisation
This commit is contained in:
parent
161e37c21b
commit
5e9b096257
@ -2,6 +2,7 @@ import Controller from '@ember/controller';
|
||||
import {action} from '@ember/object';
|
||||
import {getSymbol} from 'ghost-admin/utils/currency';
|
||||
import {inject as service} from '@ember/service';
|
||||
import {task} from 'ember-concurrency-decorators';
|
||||
import {tracked} from '@glimmer/tracking';
|
||||
|
||||
export default class DashboardController extends Controller {
|
||||
@ -32,6 +33,8 @@ export default class DashboardController extends Controller {
|
||||
@tracked newsletterOpenRatesError = null;
|
||||
@tracked newsletterOpenRatesLoading = false;
|
||||
|
||||
@tracked latestNewsletters = null;
|
||||
|
||||
@tracked whatsNewEntries = null;
|
||||
@tracked whatsNewEntriesLoading = null;
|
||||
@tracked whatsNewEntriesError = null;
|
||||
@ -50,6 +53,7 @@ export default class DashboardController extends Controller {
|
||||
this.loadEvents();
|
||||
this.loadTopMembers();
|
||||
this.loadCharts();
|
||||
this.loadLatestNewsletters.perform();
|
||||
this.loadWhatsNew();
|
||||
}
|
||||
|
||||
@ -169,6 +173,14 @@ export default class DashboardController extends Controller {
|
||||
});
|
||||
}
|
||||
|
||||
@task
|
||||
*loadLatestNewsletters() {
|
||||
this.latestNewsletters = yield this.store.query('email', {
|
||||
limit: 5,
|
||||
order: 'created_at desc'
|
||||
});
|
||||
}
|
||||
|
||||
loadNewsletterOpenRates() {
|
||||
this.newsletterOpenRatesLoading = true;
|
||||
this.membersStats.fetchNewsletterStats().then((results) => {
|
||||
|
@ -135,8 +135,40 @@
|
||||
</section>
|
||||
{{/if}}
|
||||
|
||||
|
||||
<section class="gh-dashboard-area mixed">
|
||||
<div class="gh-dashboard-container">
|
||||
<div class="gh-dashboard-box">
|
||||
<div class="gh-dashboard-header-container">
|
||||
<h4 class="gh-dashboard-header w-100">Latest newsletters</h4>
|
||||
</div>
|
||||
<div class="content">
|
||||
{{#if this.loadLatestNewsletters.isRunning}}
|
||||
Loading...
|
||||
{{else}}
|
||||
<ol class="gh-list">
|
||||
<li class="gh-list-row header">
|
||||
<div class="gh-list-header w-100">Title</div>
|
||||
<div class="gh-list-header">Sends</div>
|
||||
<div class="gh-list-header">Open %</div>
|
||||
</li>
|
||||
{{#each this.latestNewsletters as |newsletter|}}
|
||||
<li class="gh-list-row">
|
||||
<LinkTo @route="editor.edit" @models={{array "post" newsletter.postId}} class="gh-list-data">{{newsletter.subject}}</LinkTo>
|
||||
<div class="gh-list-data">{{newsletter.emailCount}}</div>
|
||||
<div class="gh-list-data">{{newsletter.openRate}}%</div>
|
||||
</li>
|
||||
{{else}}
|
||||
<li>No newsletters sent.</li>
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="footer">
|
||||
<LinkTo @route="posts" class="green">See all posts</LinkTo>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#if (not this.feature.launchComplete)}}
|
||||
<div class="gh-dashboard-container start-contents">
|
||||
<div class="gh-dashboard-box blogpost">
|
||||
|
Loading…
Reference in New Issue
Block a user