mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
newsletter and notifications
This commit is contained in:
parent
a8bf2d0f1c
commit
c9ba892057
2 changed files with 79 additions and 131 deletions
|
@ -1,30 +1,17 @@
|
|||
// Meteor.startup(function () {
|
||||
// Notification email
|
||||
Picker.route('/email/campaign', function(params, req, res, next) {
|
||||
var campaign = buildCampaign(getCampaignPosts(Settings.get('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>';
|
||||
res.end(campaignSubject+campaignSchedule+campaign.html);
|
||||
});
|
||||
|
||||
// Router.route('/email/campaign', {
|
||||
// name: 'campaign',
|
||||
// where: 'server',
|
||||
// action: function() {
|
||||
// var campaign = buildCampaign(getCampaignPosts(Settings.get('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 = Telescope.email.getTemplate('emailDigestConfirmation')({
|
||||
// time: 'January 1st, 1901',
|
||||
// newsletterLink: 'http://example.com',
|
||||
// subject: 'Lorem ipsum dolor sit amet'
|
||||
// });
|
||||
// this.response.write(Telescope.email.buildTemplate(confirmationHtml));
|
||||
// this.response.end();
|
||||
// }
|
||||
// });
|
||||
|
||||
// });
|
||||
// Notification email
|
||||
Picker.route('/email/digest-confirmation', function(params, req, res, next) {
|
||||
var confirmationHtml = Telescope.email.getTemplate('emailDigestConfirmation')({
|
||||
time: 'January 1st, 1901',
|
||||
newsletterLink: 'http://example.com',
|
||||
subject: 'Lorem ipsum dolor sit amet'
|
||||
});
|
||||
res.end(Telescope.email.buildTemplate(confirmationHtml));
|
||||
});
|
|
@ -1,107 +1,68 @@
|
|||
// Meteor.startup(function () {
|
||||
|
||||
// // Notification email
|
||||
// Notification email
|
||||
Picker.route('/email/notification/:id?', function(params, req, res, next) {
|
||||
var notification = Herald.collection.findOne(params.id);
|
||||
var notificationContents = buildEmailNotification(notification);
|
||||
res.end(notificationContents.html);
|
||||
});
|
||||
|
||||
// Router.route('/email/notification/:id?', {
|
||||
// name: 'notification',
|
||||
// where: 'server',
|
||||
// action: function() {
|
||||
// var notification = Herald.collection.findOne(this.params.id);
|
||||
// var notificationContents = buildEmailNotification(notification);
|
||||
// this.response.write(notificationContents.html);
|
||||
// this.response.end();
|
||||
// }
|
||||
// });
|
||||
// New user email
|
||||
Picker.route('/email/new-user/:id?', function(params, req, res, next) {
|
||||
var html;
|
||||
var user = Meteor.users.findOne(params.id);
|
||||
var emailProperties = {
|
||||
profileUrl: Users.getProfileUrl(user),
|
||||
username: Users.getUserName(user)
|
||||
};
|
||||
html = Telescope.email.getTemplate('emailNewUser')(emailProperties);
|
||||
res.end(Telescope.email.buildTemplate(html));
|
||||
});
|
||||
|
||||
// // New user email
|
||||
// New post email
|
||||
Picker.route('/email/new-post/:id?', function(params, req, res, next) {
|
||||
var html;
|
||||
var post = Posts.findOne(params.id);
|
||||
if (!!post) {
|
||||
html = Telescope.email.getTemplate('emailNewPost')(Posts.getNotificationProperties(post));
|
||||
} else {
|
||||
html = "<h3>No post found.</h3>"
|
||||
}
|
||||
res.end(Telescope.email.buildTemplate(html));
|
||||
});
|
||||
|
||||
// Router.route('/email/new-user/:id?', {
|
||||
// name: 'newUser',
|
||||
// where: 'server',
|
||||
// action: function() {
|
||||
// var html;
|
||||
// var user = Meteor.users.findOne(this.params.id);
|
||||
// var emailProperties = {
|
||||
// profileUrl: Users.getProfileUrl(user),
|
||||
// username: Users.getUserName(user)
|
||||
// };
|
||||
// html = Telescope.email.getTemplate('emailNewUser')(emailProperties);
|
||||
// this.response.write(Telescope.email.buildTemplate(html));
|
||||
// this.response.end();
|
||||
// }
|
||||
// });
|
||||
// Post approved
|
||||
Picker.route('/email/post-approved/:id?', function(params, req, res, next) {
|
||||
var html;
|
||||
var post = Posts.findOne(params.id);
|
||||
if (!!post) {
|
||||
html = Telescope.email.getTemplate('emailPostApproved')(Posts.getNotificationProperties(post));
|
||||
} else {
|
||||
html = "<h3>No post found.</h3>"
|
||||
}
|
||||
res.end(Telescope.email.buildTemplate(html));
|
||||
});
|
||||
|
||||
// // New post email
|
||||
// New comment email
|
||||
Picker.route('/email/new-comment/:id?', function(params, req, res, next) {
|
||||
var html;
|
||||
var comment = Comments.findOne(params.id);
|
||||
var post = Posts.findOne(comment.postId);
|
||||
if (!!comment) {
|
||||
html = Telescope.email.getTemplate('emailNewComment')(Comments.getNotificationProperties(comment, post));
|
||||
} else {
|
||||
html = "<h3>No post found.</h3>"
|
||||
}
|
||||
res.end(Telescope.email.buildTemplate(html));
|
||||
});
|
||||
|
||||
// Router.route('/email/new-post/:id?', {
|
||||
// name: 'newPost',
|
||||
// where: 'server',
|
||||
// action: function() {
|
||||
// var html;
|
||||
// var post = Posts.findOne(this.params.id);
|
||||
// if (!!post) {
|
||||
// html = Telescope.email.getTemplate('emailNewPost')(Posts.getNotificationProperties(post));
|
||||
// } else {
|
||||
// html = "<h3>No post found.</h3>"
|
||||
// }
|
||||
// this.response.write(Telescope.email.buildTemplate(html));
|
||||
// this.response.end();
|
||||
// }
|
||||
// });
|
||||
|
||||
// // Post approved
|
||||
|
||||
// Router.route('/email/post-approved/:id?', {
|
||||
// name: 'postApproved',
|
||||
// where: 'server',
|
||||
// action: function() {
|
||||
// var html;
|
||||
// var post = Posts.findOne(this.params.id);
|
||||
// if (!!post) {
|
||||
// html = Telescope.email.getTemplate('emailPostApproved')(Posts.getNotificationProperties(post));
|
||||
// } else {
|
||||
// html = "<h3>No post found.</h3>"
|
||||
// }
|
||||
// this.response.write(Telescope.email.buildTemplate(html));
|
||||
// this.response.end();
|
||||
// }
|
||||
// });
|
||||
|
||||
// // New comment email
|
||||
|
||||
// Router.route('/email/new-comment/:id?', {
|
||||
// name: 'newComment',
|
||||
// where: 'server',
|
||||
// action: function() {
|
||||
// var html;
|
||||
// var comment = Comments.findOne(this.params.id);
|
||||
// var post = Posts.findOne(comment.postId);
|
||||
// if (!!comment) {
|
||||
// html = Telescope.email.getTemplate('emailNewComment')(Comments.getNotificationProperties(comment, post));
|
||||
// } else {
|
||||
// html = "<h3>No post found.</h3>"
|
||||
// }
|
||||
// this.response.write(Telescope.email.buildTemplate(html));
|
||||
// this.response.end();
|
||||
// }
|
||||
// });
|
||||
|
||||
// // New reply email
|
||||
|
||||
// Router.route('/email/new-reply/:id?', {
|
||||
// name: 'newReply',
|
||||
// where: 'server',
|
||||
// action: function() {
|
||||
// var html;
|
||||
// var comment = Comments.findOne(this.params.id);
|
||||
// var post = Posts.findOne(comment.postId);
|
||||
// if (!!comment) {
|
||||
// html = Telescope.email.getTemplate('emailNewReply')(Comments.getNotificationProperties(comment, post));
|
||||
// } else {
|
||||
// html = "<h3>No post found.</h3>"
|
||||
// }
|
||||
// this.response.write(Telescope.email.buildTemplate(html));
|
||||
// this.response.end();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// New reply email
|
||||
Picker.route('/email/new-comment/:id?', function(params, req, res, next) {
|
||||
var html;
|
||||
var comment = Comments.findOne(params.id);
|
||||
var post = Posts.findOne(comment.postId);
|
||||
if (!!comment) {
|
||||
html = Telescope.email.getTemplate('emailNewReply')(Comments.getNotificationProperties(comment, post));
|
||||
} else {
|
||||
html = "<h3>No post found.</h3>"
|
||||
}
|
||||
res.end(Telescope.email.buildTemplate(html));
|
||||
});
|
Loading…
Add table
Reference in a new issue