mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 18:11:40 -05:00
Add logo to email templates
This commit is contained in:
parent
ea9ca1e1c5
commit
cb4e27d4ba
4 changed files with 24 additions and 19 deletions
|
@ -30,12 +30,7 @@ Notifications.allow({
|
||||||
});
|
});
|
||||||
|
|
||||||
createNotification = function(event, properties, userToNotify) {
|
createNotification = function(event, properties, userToNotify) {
|
||||||
// console.log('adding new notification for:'+getDisplayName(userToNotify)+', for event:'+event);
|
|
||||||
// console.log(userToNotify);
|
|
||||||
// console.log(properties);
|
|
||||||
|
|
||||||
// 1. Store notification in database
|
// 1. Store notification in database
|
||||||
|
|
||||||
var notification = {
|
var notification = {
|
||||||
timestamp: new Date().getTime(),
|
timestamp: new Date().getTime(),
|
||||||
userId: userToNotify._id,
|
userId: userToNotify._id,
|
||||||
|
@ -45,12 +40,8 @@ createNotification = function(event, properties, userToNotify) {
|
||||||
};
|
};
|
||||||
var newNotificationId=Notifications.insert(notification);
|
var newNotificationId=Notifications.insert(notification);
|
||||||
|
|
||||||
// 2. Send notification by email
|
// 2. Send notification by email (if on server)
|
||||||
|
|
||||||
if(Meteor.isServer && getUserSetting('notifications.replies', false, userToNotify)){
|
if(Meteor.isServer && getUserSetting('notifications.replies', false, userToNotify)){
|
||||||
// send the notification if notifications are activated,
|
|
||||||
// the notificationsFrequency is set to 1, or if it's undefined (legacy compatibility)
|
|
||||||
// get specific notification content for "email" context
|
|
||||||
notificationEmail = buildEmailNotification(notification);
|
notificationEmail = buildEmailNotification(notification);
|
||||||
sendEmail(getEmail(userToNotify), notificationEmail.subject, notificationEmail.html);
|
sendEmail(getEmail(userToNotify), notificationEmail.subject, notificationEmail.html);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,23 @@
|
||||||
buildEmailTemplate = function (htmlContent) {
|
buildEmailTemplate = function (htmlContent) {
|
||||||
|
|
||||||
var juice = Meteor.require('juice');
|
var juice = Meteor.require('juice');
|
||||||
|
|
||||||
var emailHTML = Handlebars.templates[getTemplate('emailWrapper')]({
|
var emailProperties = {
|
||||||
headerColor: getSetting('headerColor'),
|
headerColor: getSetting('headerColor'),
|
||||||
buttonColor: getSetting('buttonColor'),
|
buttonColor: getSetting('buttonColor'),
|
||||||
logo: '',
|
|
||||||
siteName: getSetting('title'),
|
siteName: getSetting('title'),
|
||||||
|
tagline: getSetting('tagline'),
|
||||||
siteUrl: getSiteUrl(),
|
siteUrl: getSiteUrl(),
|
||||||
body: htmlContent,
|
body: htmlContent,
|
||||||
unsubscribe: '',
|
unsubscribe: '',
|
||||||
accountLink: getSiteUrl()+'account',
|
accountLink: getSiteUrl()+'account',
|
||||||
footer: getSetting('emailFooter')
|
footer: getSetting('emailFooter'),
|
||||||
});
|
logoUrl: getSetting('logoUrl'),
|
||||||
|
logoHeight: getSetting('logoHeight'),
|
||||||
|
logoWidth: getSetting('logoWidth')
|
||||||
|
}
|
||||||
|
|
||||||
|
var emailHTML = Handlebars.templates[getTemplate('emailWrapper')](emailProperties);
|
||||||
|
|
||||||
var inlinedHTML = Async.runSync(function(done) {
|
var inlinedHTML = Async.runSync(function(done) {
|
||||||
juice.juiceContent(emailHTML, {
|
juice.juiceContent(emailHTML, {
|
||||||
|
|
|
@ -2,6 +2,7 @@ getUnsubscribeLink = function(user){
|
||||||
return Meteor.absoluteUrl()+'unsubscribe/'+user.email_hash;
|
return Meteor.absoluteUrl()+'unsubscribe/'+user.email_hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// given a notification, return the correct subject and html to send an email
|
||||||
buildEmailNotification = function (notification) {
|
buildEmailNotification = function (notification) {
|
||||||
var subject, template;
|
var subject, template;
|
||||||
|
|
||||||
|
|
|
@ -48,14 +48,17 @@
|
||||||
}
|
}
|
||||||
.heading-container{
|
.heading-container{
|
||||||
background: {{headerColor}};
|
background: {{headerColor}};
|
||||||
color: white;
|
|
||||||
font-family: Helvetica, sans-serif;
|
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-weight: bold;
|
|
||||||
font-size: 20px;
|
|
||||||
border-radius: 3px 3px 0px 0px;
|
border-radius: 3px 3px 0px 0px;
|
||||||
}
|
}
|
||||||
|
.heading-container, .logo{
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
font-family: Helvetica, sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
.main-container{
|
.main-container{
|
||||||
line-height: 1.7;
|
line-height: 1.7;
|
||||||
background: white;
|
background: white;
|
||||||
|
@ -103,7 +106,11 @@
|
||||||
<table border="0" width="600" cellpadding="0" cellspacing="0" class="container" bgcolor="#ffffff">
|
<table border="0" width="600" cellpadding="0" cellspacing="0" class="container" bgcolor="#ffffff">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="heading-container">
|
<td class="heading-container">
|
||||||
{{siteName}}
|
{{#if logoUrl}}
|
||||||
|
<img class="logo" src="{{logoUrl}}" height="{{logoHeight}}" width="{{logoWidth}}" alt="{{siteName}}"/>
|
||||||
|
{{else}}
|
||||||
|
{{siteName}}
|
||||||
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Add table
Reference in a new issue