Skip to content

Commit

Permalink
Merge pull request #89 from citizenos/cos_to_email_footer
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmartyrk committed Jan 15, 2019
2 parents 50068c5 + 82aee44 commit 29e1c6a
Show file tree
Hide file tree
Showing 12 changed files with 320 additions and 92 deletions.
1 change: 1 addition & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
}
},
"from": "CitizenOS <no-reply@citizenos.com>",
"linkToPrivacyPolicy": "https://app.citizenos.com/en/topics/7abdd244-d45b-40d3-997c-a6290d4e972c",
"trap": false
},
"services": {
Expand Down
59 changes: 59 additions & 0 deletions libs/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ module.exports = function (app) {
var templateRootLocal = app.get('EMAIL_TEMPLATE_ROOT_LOCAL');

var emailHeaderLogoName = 'logo.png';
var emailFooterLogoName = 'logo_footer.png';
var emailHeaderLogo = path.join(templateRoot, 'images/logo-email.png');
var emailFooterLogo = path.join(templateRoot, 'images/logo-email-small.png');
if (fs.existsSync(path.join(templateRootLocal, 'images/logo-email.png'))) { //eslint-disable-line no-sync
emailHeaderLogo = path.join(templateRootLocal, 'images/logo-email.png');
}
logger.info('Using email header logo from', emailHeaderLogo);

var linkToPlatform = config.email.linkToPlatform || urlLib.getFe();
var linkToPrivacyPolicy = config.email.linkToPrivacyPolicy;

var templateCache = {};

/**
Expand Down Expand Up @@ -120,12 +125,18 @@ module.exports = function (app) {
{
name: emailHeaderLogoName,
file: emailHeaderLogo
},
{
name: emailFooterLogoName,
file: emailFooterLogo
}
],
//Placeholders
toUser: user,
linkVerify: linkVerify,
linkToApplication: urlLib.getFe(),
linkToPlatform: linkToPlatform,
linkToPrivacyPolicy: linkToPrivacyPolicy,
provider: {
merge: {} // TODO: empty merge required until fix - https://github.com/bevacqua/campaign-mailgun/issues/1
}
Expand Down Expand Up @@ -168,13 +179,19 @@ module.exports = function (app) {
{
name: emailHeaderLogoName,
file: emailHeaderLogo
},
{
name: emailFooterLogoName,
file: emailFooterLogo
}
],
social: config.email.social, // social.name maps to "from_name". I think this should be part of Campaign client config OR at least defaults can be set somewhere in client options
//Placeholders..
toUser: user,
linkReset: urlLib.getFe('/account/password/reset/:passwordResetCode', {passwordResetCode: passwordResetCode}, {email: user.email}),
linkToApplication: urlLib.getFe(),
linkToPlatform: linkToPlatform,
linkToPrivacyPolicy: linkToPrivacyPolicy,
provider: {
merge: {} // TODO: empty merge required until fix - https://github.com/bevacqua/campaign-mailgun/issues/1
}
Expand Down Expand Up @@ -314,6 +331,10 @@ module.exports = function (app) {
{
name: emailHeaderLogoName,
file: logoFile
},
{
name: emailFooterLogoName,
file: emailFooterLogo
}
],
social: config.email.social, // social.name maps to "from_name". I think this should be part of Campaign client config OR at least defaults can be set somewhere in client options
Expand All @@ -322,6 +343,8 @@ module.exports = function (app) {
topic: topic,
linkViewTopic: linkViewTopic,
linkToApplication: linkToApplication,
linkToPlatform: linkToPlatform,
linkToPrivacyPolicy: linkToPrivacyPolicy,
provider: {
merge: {} // TODO: empty merge required until fix - https://github.com/bevacqua/campaign-mailgun/issues/1
}
Expand Down Expand Up @@ -433,6 +456,10 @@ module.exports = function (app) {
{
name: emailHeaderLogoName,
file: emailHeaderLogo
},
{
name: emailFooterLogoName,
file: emailFooterLogo
}
],
social: config.email.social, // social.name maps to "from_name". I think this should be part of Campaign client config OR at least defaults can be set somewhere in client options
Expand All @@ -441,6 +468,8 @@ module.exports = function (app) {
topic: topic,
linkViewTopic: linkViewTopic,
linkToApplication: urlLib.getFe(),
linkToPlatform: linkToPlatform,
linkToPrivacyPolicy: linkToPrivacyPolicy,
provider: {
merge: {} // TODO: empty merge required until fix - https://github.com/bevacqua/campaign-mailgun/issues/1
}
Expand Down Expand Up @@ -529,6 +558,10 @@ module.exports = function (app) {
{
name: emailHeaderLogoName,
file: emailHeaderLogo
},
{
name: emailFooterLogoName,
file: emailFooterLogo
}
],
social: config.email.social, // social.name maps to "from_name". I think this should be part of Campaign client config OR at least defaults can be set somewhere in client options
Expand All @@ -541,6 +574,8 @@ module.exports = function (app) {
groupId: group.id
}),
linkToApplication: urlLib.getFe(),
linkToPlatform: linkToPlatform,
linkToPrivacyPolicy: linkToPrivacyPolicy,
provider: {
merge: {} // TODO: empty merge required until fix - https://github.com/bevacqua/campaign-mailgun/issues/1
}
Expand Down Expand Up @@ -713,6 +748,10 @@ module.exports = function (app) {
{
name: emailHeaderLogoName,
file: emailHeaderLogo
},
{
name: emailFooterLogoName,
file: emailFooterLogo
}
],
//Placeholders
Expand All @@ -723,6 +762,8 @@ module.exports = function (app) {
},
linkViewTopic: linkViewTopic,
linkToApplication: urlLib.getFe(),
linkToPlatform: linkToPlatform,
linkToPrivacyPolicy: linkToPrivacyPolicy,
provider: {
merge: {} // TODO: empty merge required until fix - https://github.com/bevacqua/campaign-mailgun/issues/1
}
Expand Down Expand Up @@ -774,6 +815,10 @@ module.exports = function (app) {
{
name: emailHeaderLogoName,
file: emailHeaderLogo
},
{
name: emailFooterLogoName,
file: emailFooterLogo
}
],
//Placeholders...
Expand All @@ -785,6 +830,8 @@ module.exports = function (app) {
linkModerate: linkModerate + '?token=' + encodeURIComponent(token),
isUserNotified: commentCreatorInformed,
linkToApplication: urlLib.getFe(),
linkToPlatform: linkToPlatform,
linkToPrivacyPolicy: linkToPrivacyPolicy,
provider: {
merge: {} // TODO: empty merge required until fix - https://github.com/bevacqua/campaign-mailgun/issues/1
}
Expand Down Expand Up @@ -843,6 +890,10 @@ module.exports = function (app) {
{
name: emailHeaderLogoName,
file: logoFile
},
{
name: emailFooterLogoName,
file: emailFooterLogo
}
],
social: config.email.social, // social.name maps to "from_name". I think this should be part of Campaign client config OR at least defaults can be set somewhere in client options
Expand All @@ -852,6 +903,8 @@ module.exports = function (app) {
linkDownloadBdocFinalExpiryDate: moment(linkDownloadBdocFinalExpiryDate).locale('et').format('LL'),
linkAddEvent: linkAddEvent,
linkToApplication: linkToApplication,
linkToPlatform: linkToPlatform,
linkToPrivacyPolicy: linkToPrivacyPolicy,
topic: topic,
contact: contact,
provider: {
Expand Down Expand Up @@ -882,6 +935,10 @@ module.exports = function (app) {
{
name: emailHeaderLogoName,
file: logoFile
},
{
name: emailFooterLogoName,
file: emailFooterLogo
}
],
social: config.email.social, // social.name maps to "from_name". I think this should be part of Campaign client config OR at least defaults can be set somewhere in client options
Expand All @@ -891,6 +948,8 @@ module.exports = function (app) {
linkDownloadBdocFinalExpiryDate: moment(linkDownloadBdocFinalExpiryDate).locale('et').format('LL'),
linkAddEvent: null,
linkToApplication: linkToApplication,
linkToPlatform: linkToPlatform,
linkToPrivacyPolicy: linkToPrivacyPolicy,
topic: topic,
contact: contact,
provider: {
Expand Down
37 changes: 28 additions & 9 deletions views/emails/accountVerification.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@

<tr>
<td align="center" valign="middle" style="background-color: #FFFFFF;border-bottom: 1px solid #f0f0f0;" height="80">
<p style="font-family: georgia, serif;font-size:19px; font-weight:bold;background-color: #FFFFFF; color:#252525;">Hi {{toUser.name}}!</p>
<p style="font-family: Noto-Serif;font-size:20px; font-weight:bold;background-color: #FFFFFF; color:#252525;">Hi {{toUser.name}}!</p>
</td>
</tr>

<tr>
<td align="center" valign="middle" style="background-color: #FFFFFF;border-bottom: 1px solid #f0f0f0; border-top: 1px solid #fbfbfb; " height="130">
<p style="font-family: arial, helvetica, sans-serif;font-size:14px;background-color: #FFFFFF; color:#252525;">To activate your account, please verify your email address by clicking the link below.</p>
<p style="font-family: georgia, serif;font-size:18px; font-weight: bold; font-style: italic ;background-color: #FFFFFF; color:#0680fc;"><a href="{{linkVerify}}" target="_blank">Verify my email.</a></p>
<p style="font-family:Open Sans,sans-serif; font-size:14px;background-color: #FFFFFF; color:#252525;">To activate your account, please verify your email address by clicking the link below.</p>
<p style="font-family:Open Sans,sans-serif; font-size:20px; font-weight: bold; background-color: #FFFFFF; color:#0680fc;"><a href="{{linkVerify}}" target="_blank" style="color:#0680FC; text-decoration: none; font-family: Open Sans,sans-serif;">Verify my email.</a></p>
</td>
</tr>

<tr>
<td align="center" valign="bottom" style="background-color: #FFFFFF;border-top: 1px solid #fbfbfb;" height="120">
<p style="font-family: arial, helvetica, sans-serif;font-size:14px;background-color: #FFFFFF; color:#252525;">Citizen OS team</p>
<p style="font-family:Open Sans,sans-serif; font-size:14px;background-color: #FFFFFF; color:#252525;">Citizen OS team</p>
</td>
</tr>

Expand All @@ -57,13 +57,32 @@
</td>
</tr>

<tr>
<td align="center" valign="top" height="70">
<table border="0" cellpadding="0" cellspacing="0" id="templateFooter" style="background-color: #f6f6f6;margin: 0;padding: 0;" width="600">
<tr>
<td align="center" valign="top" height="60">
<table style="background-color: #eaeaea; padding: 0 15px;" width="600">
<tbody>
<tr>
<td align="center" height="70" style="border-collapse: collapse" valign="middle">
<p style="font-family: arial, helvetica, sans-serif;font-size:12px;background-color: #f6f6f6; color:#828282;">Learn more on <a href="{{linkToApplication}}" target="_blank" style=" color:#828282; text-decoration:underline;">{{linkToApplication}}</a></p>
<td>
<table>
<tbody>
<tr>
<td style="font-family:Open Sans,sans-serif;"><a href="{{linkToPlatform}}" target="_blank" style="font-family: Open Sans,sans-serif; font-size:13px;">Link to platform</a></td>
<td style="font-family:Open Sans,sans-serif; padding-left: 15px;"><a href="{{linkToPrivacyPolicy}}" target="_blank" style="color:#0680FC; text-decoration: none; font-family: Open Sans,sans-serif; font-size:13px;">Privacy Policy</a></td>
</tr>
</tbody>
</table>
</td>
<td align="right" valign="middle" height="60">
<a href="https://citizenos.com" target="_blank" style="color: black; text-decoration: none;">
<table>
<tbody>
<tr>
<td style="font-family:Open Sans,sans-serif; font-size: 13px;">Empowered by</td>
<td><img width="97" height="18" src="cid:logo_footer.png" alt="logo" style="display:block;" border="0"/></td>
</tr>
</tbody>
</table>
</a>
</td>
</tr>
</tbody>
Expand Down
Binary file added views/emails/images/logo-email-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 29e1c6a

Please sign in to comment.