mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-03 00:15:11 +03:00
Added authors to email preview template
This commit is contained in:
parent
c64be968c1
commit
4db260f17e
@ -20,7 +20,7 @@ module.exports = {
|
||||
],
|
||||
permissions: true,
|
||||
query(frame) {
|
||||
const options = Object.assign(frame.options, {formats: 'html,plaintext'});
|
||||
const options = Object.assign(frame.options, {formats: 'html,plaintext', withRelated: ['authors']});
|
||||
return models.Post.findOne(frame.data, options)
|
||||
.then((model) => {
|
||||
if (!model) {
|
||||
|
@ -12,6 +12,7 @@ const getSite = () => {
|
||||
|
||||
const serialize = (post) => {
|
||||
post.published_at = post.published_at ? moment(post.published_at).format('DD MMM YYYY') : moment().format('DD MMM YYYY');
|
||||
post.authors = post.authors && post.authors.map(author => author.name).join(',');
|
||||
return {
|
||||
subject: post.email_subject || post.title,
|
||||
html: juice(template({post, site: getSite()})),
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* eslint indent: warn, no-irregular-whitespace: warn */
|
||||
module.exports = ({post, site}) => {
|
||||
const currentYear = new Date();
|
||||
const date = new Date();
|
||||
return `<!doctype html>
|
||||
<html>
|
||||
|
||||
@ -805,7 +805,7 @@ figure blockquote p {
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="post-meta">
|
||||
By Authors –
|
||||
By ${post.authors} –
|
||||
${post.published_at} –
|
||||
<a href="${post.url}" class="view-online-link">View online →</a>
|
||||
</td>
|
||||
@ -840,7 +840,7 @@ figure blockquote p {
|
||||
<td class="wrapper">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="footer">${site.title} © ${currentYear.getFullYear()} – <a href="%recipient.unsubscribe_url%">Unsubscribe</a></td>
|
||||
<td class="footer">${site.title} © ${date.getFullYear()} – <a href="%recipient.unsubscribe_url%">Unsubscribe</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user