mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Display "sent" info in publish menu
This commit is contained in:
parent
6419222f31
commit
56cfbf2cd2
7 changed files with 69 additions and 13 deletions
|
@ -14,6 +14,8 @@ export default Component.extend({
|
||||||
postStatus: 'draft',
|
postStatus: 'draft',
|
||||||
saveTask: null,
|
saveTask: null,
|
||||||
runningText: null,
|
runningText: null,
|
||||||
|
backgroundTask: null,
|
||||||
|
deliveredAction: null,
|
||||||
|
|
||||||
_publishedAtBlogTZ: null,
|
_publishedAtBlogTZ: null,
|
||||||
_previousStatus: null,
|
_previousStatus: null,
|
||||||
|
|
|
@ -3,6 +3,7 @@ import PostModel from 'ghost-admin/models/post';
|
||||||
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
||||||
import config from 'ghost-admin/config/environment';
|
import config from 'ghost-admin/config/environment';
|
||||||
import isNumber from 'ghost-admin/utils/isNumber';
|
import isNumber from 'ghost-admin/utils/isNumber';
|
||||||
|
import moment from 'moment';
|
||||||
import {alias, mapBy} from '@ember/object/computed';
|
import {alias, mapBy} from '@ember/object/computed';
|
||||||
import {computed} from '@ember/object';
|
import {computed} from '@ember/object';
|
||||||
import {inject as controller} from '@ember/controller';
|
import {inject as controller} from '@ember/controller';
|
||||||
|
@ -132,6 +133,10 @@ export default Controller.extend({
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
deliveredAction: computed('actionsList', function () {
|
||||||
|
return this.actionsList && this.actionsList.findBy('event', 'delivered');
|
||||||
|
}),
|
||||||
|
|
||||||
_autosaveRunning: computed('_autosave.isRunning', '_timedSave.isRunning', function () {
|
_autosaveRunning: computed('_autosave.isRunning', '_timedSave.isRunning', function () {
|
||||||
let autosave = this.get('_autosave.isRunning');
|
let autosave = this.get('_autosave.isRunning');
|
||||||
let timedsave = this.get('_timedSave.isRunning');
|
let timedsave = this.get('_timedSave.isRunning');
|
||||||
|
@ -531,6 +536,15 @@ export default Controller.extend({
|
||||||
}
|
}
|
||||||
}).enqueue(),
|
}).enqueue(),
|
||||||
|
|
||||||
|
// load supplementel data such as the actions list in the background
|
||||||
|
backgroundLoader: task(function* () {
|
||||||
|
let actions = yield this.store.query('action', {
|
||||||
|
filter: `resource_type:post+resource_id:${this.post.id}+event:delivered`,
|
||||||
|
limit: 'all'
|
||||||
|
});
|
||||||
|
this.set('actionsList', actions);
|
||||||
|
}).restartable(),
|
||||||
|
|
||||||
/* Public methods --------------------------------------------------------*/
|
/* Public methods --------------------------------------------------------*/
|
||||||
|
|
||||||
// called by the new/edit routes to change the post model
|
// called by the new/edit routes to change the post model
|
||||||
|
@ -546,6 +560,7 @@ export default Controller.extend({
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
||||||
this.set('post', post);
|
this.set('post', post);
|
||||||
|
this.backgroundLoader.perform();
|
||||||
|
|
||||||
// autofocus the editor if we have a new post
|
// autofocus the editor if we have a new post
|
||||||
this.set('shouldFocusEditor', post.get('isNew'));
|
this.set('shouldFocusEditor', post.get('isNew'));
|
||||||
|
|
12
ghost/admin/app/models/action.js
Normal file
12
ghost/admin/app/models/action.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import Model from 'ember-data/model';
|
||||||
|
import attr from 'ember-data/attr';
|
||||||
|
|
||||||
|
export default Model.extend({
|
||||||
|
resourceId: attr('string'),
|
||||||
|
resourceType: attr('string'),
|
||||||
|
actorId: attr('string'),
|
||||||
|
actorType: attr('string'),
|
||||||
|
event: attr('string'),
|
||||||
|
context: attr('json-string'),
|
||||||
|
createdAtUTC: attr('moment-utc')
|
||||||
|
});
|
8
ghost/admin/app/serializers/action.js
Normal file
8
ghost/admin/app/serializers/action.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
/* eslint-disable camelcase */
|
||||||
|
import ApplicationSerializer from 'ghost-admin/serializers/application';
|
||||||
|
|
||||||
|
export default ApplicationSerializer.extend({
|
||||||
|
attrs: {
|
||||||
|
createdAtUTC: {key: 'created_at'}
|
||||||
|
}
|
||||||
|
});
|
|
@ -25,7 +25,19 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if this.feature.labs.members}}
|
{{#if this.feature.labs.members}}
|
||||||
<div class="flex mb4">
|
<div class="flex mb4 justify-center">
|
||||||
|
{{#if this.backgroundLoader.isRunning}}
|
||||||
|
<div class="gh-loading-spinner" style="zoom: 50%"></div>
|
||||||
|
{{else}}
|
||||||
|
{{#if this.deliveredAction}}
|
||||||
|
<div class="mr3">
|
||||||
|
💌
|
||||||
|
</div>
|
||||||
|
<div class="flex-grow-1">
|
||||||
|
<div class="gh-publishmenu-radio-label">Sent</div>
|
||||||
|
<div class="gh-publishmenu-radio-desc">Post was sent {{gh-format-post-time this.deliveredAction.createdAtUTC}}</div>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
<div class="for-switch mr3">
|
<div class="for-switch mr3">
|
||||||
<label class="switch" for="email-when-published-checkbox">
|
<label class="switch" for="email-when-published-checkbox">
|
||||||
<Input @checked={{this.post.sendEmailWhenPublished}} @type="checkbox" @id="email-when-published-checkbox" @name="email-when-published" />
|
<Input @checked={{this.post.sendEmailWhenPublished}} @type="checkbox" @id="email-when-published-checkbox" @name="email-when-published" />
|
||||||
|
@ -33,9 +45,12 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1">
|
||||||
<div class="gh-publishmenu-radio-label">Email to members</div>
|
<div class="gh-publishmenu-radio-label">Email post</div>
|
||||||
<div class="gh-publishmenu-radio-desc">Send email when published</div>
|
<div class="gh-publishmenu-radio-desc">Send post to 56 members when published</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,9 @@
|
||||||
{{gh-publishmenu-draft
|
{{gh-publishmenu-draft
|
||||||
post=post
|
post=post
|
||||||
saveType=saveType
|
saveType=saveType
|
||||||
setSaveType=(action "setSaveType")}}
|
setSaveType=(action "setSaveType")
|
||||||
|
backgroundTask=this.backgroundTask
|
||||||
|
deliveredAction=this.deliveredAction}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{!--
|
{{!--
|
||||||
|
|
|
@ -55,7 +55,9 @@
|
||||||
postStatus=post.status
|
postStatus=post.status
|
||||||
saveTask=save
|
saveTask=save
|
||||||
setSaveType=(action "setSaveType")
|
setSaveType=(action "setSaveType")
|
||||||
onOpen=(action "cancelAutosave")}}
|
onOpen=(action "cancelAutosave")
|
||||||
|
backgroundTask=this.backgroundLoader
|
||||||
|
deliveredAction=this.deliveredAction}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue