mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Wired up the post count
This commit is contained in:
parent
a9ba4cfc74
commit
62dfa2fbbc
6 changed files with 36 additions and 41 deletions
|
@ -5,14 +5,14 @@
|
|||
{{/if}}
|
||||
|
||||
<header class="modal-header">
|
||||
<h1>{{this.post.title}}
|
||||
<h1>
|
||||
{{#unless this.post.isScheduled}}
|
||||
<span>Boom! It's out there.</span>
|
||||
<span>
|
||||
{{#if this.post.emailOnly}}
|
||||
Your email has been sent.
|
||||
{{else}}
|
||||
That's 100 posts published.
|
||||
That's {{format-number this.postCount}} {{gh-pluralize this.postCount "post" without-count=true}} published.
|
||||
{{/if}}
|
||||
</span>
|
||||
{{else}}
|
||||
|
|
|
@ -1,40 +1,16 @@
|
|||
import ModalComponent from 'ghost-admin/components/modal-base';
|
||||
// import copyTextToClipboard from 'ghost-admin/utils/copy-text-to-clipboard';
|
||||
import {alias} from '@ember/object/computed';
|
||||
// import {inject} from 'ghost-admin/decorators/inject';
|
||||
import {inject as service} from '@ember/service';
|
||||
// import {task, timeout} from 'ember-concurrency';
|
||||
|
||||
export default ModalComponent.extend({
|
||||
store: service(),
|
||||
export default class ModalPublishFlow extends ModalComponent {
|
||||
@service store;
|
||||
|
||||
classNames: 'modal-publish-flow',
|
||||
classNames = ['modal-publish-flow', ...this.classNames];
|
||||
|
||||
// signinUrl: null,
|
||||
// config: inject(),
|
||||
get post() {
|
||||
return this.model.post;
|
||||
}
|
||||
|
||||
post: alias('model')
|
||||
|
||||
// didInsertElement() {
|
||||
// this._super(...arguments);
|
||||
|
||||
// this._signinUrlUpdateTask.perform();
|
||||
// },
|
||||
|
||||
// actions: {
|
||||
// // noop - we don't want the enter key doing anything
|
||||
// confirm() {}
|
||||
// },
|
||||
|
||||
// copySigninUrl: task(function* () {
|
||||
// copyTextToClipboard(this.signinUrl);
|
||||
// yield timeout(1000);
|
||||
// return true;
|
||||
// }),
|
||||
|
||||
// _signinUrlUpdateTask: task(function*() {
|
||||
// const memberSigninURL = yield this.member.fetchSigninUrl.perform();
|
||||
|
||||
// this.set('signinUrl', memberSigninURL.url);
|
||||
// }).drop()
|
||||
});
|
||||
get postCount() {
|
||||
return this.model.postCount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<MultiList::List @model={{@list}} class="posts-list gh-list {{unless @model "no-posts"}} feature-memberAttribution" as |list| >
|
||||
{{!-- always order as scheduled, draft, remainder --}}
|
||||
{{!-- always order as scheduled, draft, remainder --}}
|
||||
{{#if (or @model.scheduledInfinityModel (or @model.draftInfinityModel @model.publishedAndSentInfinityModel))}}
|
||||
{{#if @model.scheduledInfinityModel}}
|
||||
{{#each @model.scheduledInfinityModel as |post|}}
|
||||
|
@ -47,7 +47,7 @@
|
|||
{{#if this.showPublishFlowModal}}
|
||||
<GhFullscreenModal
|
||||
@modal="publish-flow"
|
||||
@model={{this.latestScheduledPost}}
|
||||
@model={{hash post=this.latestScheduledPost}}
|
||||
@close={{this.togglePublishFlowModal}}
|
||||
@modifier="action wide" />
|
||||
{{/if}}
|
|
@ -18,7 +18,7 @@ export default class PostsList extends Component {
|
|||
checkPublishFlowModal() {
|
||||
if (localStorage.getItem('ghost-last-scheduled-post')) {
|
||||
this.getLatestScheduledPost.perform();
|
||||
this.showPublishFlowModal = true;
|
||||
// this.showPublishFlowModal = true;
|
||||
localStorage.removeItem('ghost-last-scheduled-post');
|
||||
}
|
||||
}
|
||||
|
@ -36,5 +36,6 @@ export default class PostsList extends Component {
|
|||
*getLatestScheduledPost() {
|
||||
const result = yield this.store.query('post', {filter: `id:${localStorage.getItem('ghost-last-scheduled-post')}`, limit: 1});
|
||||
this.latestScheduledPost = result.toArray()[0];
|
||||
this.showPublishFlowModal = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,7 +210,10 @@
|
|||
{{#if this.showPublishFlowModal}}
|
||||
<GhFullscreenModal
|
||||
@modal="publish-flow"
|
||||
@model={{this.post}}
|
||||
@model={{hash
|
||||
post=this.post
|
||||
postCount=this.postCount
|
||||
}}
|
||||
@close={{this.togglePublishFlowModal}}
|
||||
@modifier="action wide" />
|
||||
{{/if}}
|
|
@ -33,6 +33,7 @@ export default class Analytics extends Component {
|
|||
@tracked showSuccess;
|
||||
@tracked updateLinkId;
|
||||
@tracked showPublishFlowModal = false;
|
||||
@tracked postCount = null;
|
||||
displayOptions = DISPLAY_OPTIONS;
|
||||
|
||||
constructor() {
|
||||
|
@ -42,7 +43,8 @@ export default class Analytics extends Component {
|
|||
|
||||
checkPublishFlowModal() {
|
||||
if (localStorage.getItem('ghost-last-published-post')) {
|
||||
this.showPublishFlowModal = true;
|
||||
this.fetchPostCountTask.perform();
|
||||
// this.showPublishFlowModal = true;
|
||||
localStorage.removeItem('ghost-last-published-post');
|
||||
}
|
||||
}
|
||||
|
@ -321,6 +323,19 @@ export default class Analytics extends Component {
|
|||
this.mentions = yield this.store.query('mention', {limit: 5, order: 'created_at desc', filter});
|
||||
}
|
||||
|
||||
@task
|
||||
*fetchPostCountTask() {
|
||||
if (!this.post.emailOnly) {
|
||||
const result = yield this.store.query('post', {filter: 'status:published', limit: 1});
|
||||
let count = result.meta.pagination.total;
|
||||
|
||||
count += 1; // account for the new post
|
||||
|
||||
this.postCount = count;
|
||||
}
|
||||
this.showPublishFlowModal = true;
|
||||
}
|
||||
|
||||
get showLinks() {
|
||||
return this.post.showEmailClickAnalytics;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue