// Campaign object is only available on server, so define actions on server only import Campaign from "./campaign.js"; Telescope.email.emails.newsletter = Object.assign(Telescope.email.emails.newsletter, { getCampaign() { return Campaign.build(Campaign.getPosts(Telescope.settings.get('postsPerNewsletter', 5))); }, subject() { return this.getCampaign().subject; }, getTestHTML() { var campaign = this.getCampaign(); var newsletterEnabled = '
Newsletter Enabled: '+Telescope.settings.get('enableNewsletter', true)+'
'; var mailChimpAPIKey = '
mailChimpAPIKey: '+(typeof Telescope.settings.get('mailChimpAPIKey') !== "undefined")+'
'; var mailChimpListId = '
mailChimpListId: '+(typeof Telescope.settings.get('mailChimpListId') !== "undefined")+'
'; var campaignSubject = '
Subject: '+campaign.subject+' (note: contents might change)
'; var campaignSchedule = '
Scheduled for: '+ Meteor.call('getNextJob') +'
'; return newsletterEnabled+mailChimpAPIKey+mailChimpListId+campaignSubject+campaignSchedule+campaign.html; } }); Telescope.email.emails.newsletterConfirmation = Object.assign(Telescope.email.emails.newsletterConfirmation, { getTestHTML() { return Telescope.email.getTemplate('newsletterConfirmation')({ time: 'January 1st, 1901', newsletterLink: 'http://example.com', subject: 'Lorem ipsum dolor sit amet' }); } });