mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 18:11: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', {
|
// Notification email
|
||||||
// name: 'campaign',
|
Picker.route('/email/digest-confirmation', function(params, req, res, next) {
|
||||||
// where: 'server',
|
var confirmationHtml = Telescope.email.getTemplate('emailDigestConfirmation')({
|
||||||
// action: function() {
|
time: 'January 1st, 1901',
|
||||||
// var campaign = buildCampaign(getCampaignPosts(Settings.get('postsPerNewsletter', 5)));
|
newsletterLink: 'http://example.com',
|
||||||
// var campaignSubject = '<div class="campaign-subject"><strong>Subject:</strong> '+campaign.subject+' (note: contents might change)</div>';
|
subject: 'Lorem ipsum dolor sit amet'
|
||||||
// var campaignSchedule = '<div class="campaign-schedule"><strong>Scheduled for:</strong> '+ Meteor.call('getNextJob') +'</div>';
|
});
|
||||||
|
res.end(Telescope.email.buildTemplate(confirmationHtml));
|
||||||
// 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();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// });
|
|
|
@ -1,107 +1,68 @@
|
||||||
// Meteor.startup(function () {
|
// 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);
|
||||||
|
});
|
||||||
|
|
||||||
// // Notification email
|
// 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));
|
||||||
|
});
|
||||||
|
|
||||||
// Router.route('/email/notification/:id?', {
|
// New post email
|
||||||
// name: 'notification',
|
Picker.route('/email/new-post/:id?', function(params, req, res, next) {
|
||||||
// where: 'server',
|
var html;
|
||||||
// action: function() {
|
var post = Posts.findOne(params.id);
|
||||||
// var notification = Herald.collection.findOne(this.params.id);
|
if (!!post) {
|
||||||
// var notificationContents = buildEmailNotification(notification);
|
html = Telescope.email.getTemplate('emailNewPost')(Posts.getNotificationProperties(post));
|
||||||
// this.response.write(notificationContents.html);
|
} else {
|
||||||
// this.response.end();
|
html = "<h3>No post found.</h3>"
|
||||||
// }
|
}
|
||||||
// });
|
res.end(Telescope.email.buildTemplate(html));
|
||||||
|
});
|
||||||
|
|
||||||
// // New user email
|
// 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));
|
||||||
|
});
|
||||||
|
|
||||||
// Router.route('/email/new-user/:id?', {
|
// New comment email
|
||||||
// name: 'newUser',
|
Picker.route('/email/new-comment/:id?', function(params, req, res, next) {
|
||||||
// where: 'server',
|
var html;
|
||||||
// action: function() {
|
var comment = Comments.findOne(params.id);
|
||||||
// var html;
|
var post = Posts.findOne(comment.postId);
|
||||||
// var user = Meteor.users.findOne(this.params.id);
|
if (!!comment) {
|
||||||
// var emailProperties = {
|
html = Telescope.email.getTemplate('emailNewComment')(Comments.getNotificationProperties(comment, post));
|
||||||
// profileUrl: Users.getProfileUrl(user),
|
} else {
|
||||||
// username: Users.getUserName(user)
|
html = "<h3>No post found.</h3>"
|
||||||
// };
|
}
|
||||||
// html = Telescope.email.getTemplate('emailNewUser')(emailProperties);
|
res.end(Telescope.email.buildTemplate(html));
|
||||||
// this.response.write(Telescope.email.buildTemplate(html));
|
});
|
||||||
// this.response.end();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // New post email
|
// New reply email
|
||||||
|
Picker.route('/email/new-comment/:id?', function(params, req, res, next) {
|
||||||
// Router.route('/email/new-post/:id?', {
|
var html;
|
||||||
// name: 'newPost',
|
var comment = Comments.findOne(params.id);
|
||||||
// where: 'server',
|
var post = Posts.findOne(comment.postId);
|
||||||
// action: function() {
|
if (!!comment) {
|
||||||
// var html;
|
html = Telescope.email.getTemplate('emailNewReply')(Comments.getNotificationProperties(comment, post));
|
||||||
// var post = Posts.findOne(this.params.id);
|
} else {
|
||||||
// if (!!post) {
|
html = "<h3>No post found.</h3>"
|
||||||
// html = Telescope.email.getTemplate('emailNewPost')(Posts.getNotificationProperties(post));
|
}
|
||||||
// } else {
|
res.end(Telescope.email.buildTemplate(html));
|
||||||
// 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();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// });
|
|
Loading…
Add table
Reference in a new issue