Vulcan/packages/telescope-newsletter/lib/server/routes.js
shambles 731fc5e119 Couple of small Newsletter fixes
1) The route /email/campaign was broken in
ceeb7bf531.  the method
getNextCampaignSchedule() was removed.
e.g. http://meta.telesc.pe/email/campaign
2) The wrong comment count helper was used in the newsletter template
resulting in it being undefined and so you wouldn’t see a count. I’m
guessing this was broken when the post schema was changed as it comes
from a post’s document.
2014-12-26 01:23:23 +00:00

30 lines
No EOL
1 KiB
JavaScript

Meteor.startup(function () {
Router.route('/email/campaign', {
name: 'campaign',
where: 'server',
action: function() {
var campaign = buildCampaign(getCampaignPosts(getSetting('postsPerNewsletter', 5)));
var campaignSubject = '<div class="campaign-subject"><strong>Subject:</strong> '+campaign.subject+' (note: contents might change)</div>';
var campaignSchedule = '<div class="campaign-schedule"><strong>Scheduled for:</strong> '+ Meteor.call('getNextJob') +'</div>';
this.response.write(campaignSubject+campaignSchedule+campaign.html);
this.response.end();
}
});
Router.route('/email/digest-confirmation', {
name: 'digestConfirmation',
where: 'server',
action: function() {
var confirmationHtml = getEmailTemplate('emailDigestConfirmation')({
time: 'January 1st, 1901',
newsletterLink: 'http://example.com',
subject: 'Lorem ipsum dolor sit amet'
});
this.response.write(buildEmailTemplate(confirmationHtml));
this.response.end();
}
});
});