From 47a5eb538202994e09f0c66804a6d42b9f022554 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 15 Dec 2016 17:22:39 +0000 Subject: [PATCH] Add a new layout and body template for e-mails. --- .../Email/Bodies/SingleCTAEmailBody.coffee | 26 ++ .../coffee/Features/Email/EmailBuilder.coffee | 30 +- .../Layouts/BaseWithHeaderEmailLayout.coffee | 378 ++++++++++++++++++ 3 files changed, 420 insertions(+), 14 deletions(-) create mode 100644 services/web/app/coffee/Features/Email/Bodies/SingleCTAEmailBody.coffee create mode 100644 services/web/app/coffee/Features/Email/Layouts/BaseWithHeaderEmailLayout.coffee diff --git a/services/web/app/coffee/Features/Email/Bodies/SingleCTAEmailBody.coffee b/services/web/app/coffee/Features/Email/Bodies/SingleCTAEmailBody.coffee new file mode 100644 index 0000000000..98a0ffe30d --- /dev/null +++ b/services/web/app/coffee/Features/Email/Bodies/SingleCTAEmailBody.coffee @@ -0,0 +1,26 @@ +_ = require("underscore") +settings = require "settings-sharelatex" + +module.exports = _.template """ + + +
+
+

+ <%= title %> +

+
 
+

+ <%= greeting %> +

+

+ <%= message %> +

+
 
+
+
+ View project +
+
+
+""" diff --git a/services/web/app/coffee/Features/Email/EmailBuilder.coffee b/services/web/app/coffee/Features/Email/EmailBuilder.coffee index 70d11e219b..908aac53f1 100644 --- a/services/web/app/coffee/Features/Email/EmailBuilder.coffee +++ b/services/web/app/coffee/Features/Email/EmailBuilder.coffee @@ -1,6 +1,12 @@ _ = require('underscore') + PersonalEmailLayout = require("./Layouts/PersonalEmailLayout") NotificationEmailLayout = require("./Layouts/NotificationEmailLayout") +BaseWithHeaderEmailLayout = require("./Layouts/BaseWithHeaderEmailLayout") + +SingleCTAEmailBody = require("./Bodies/SingleCTAEmailBody") + + settings = require("settings-sharelatex") @@ -107,9 +113,9 @@ If you didn't request a password reset, let us know. templates.projectInvite = subject: _.template "<%= project.name %> - shared by <%= owner.email %>" - layout: NotificationEmailLayout + layout: BaseWithHeaderEmailLayout type:"notification" - plainTextTemplate: _.template """ + plainTextTemplate: plainTextTpl: """ Hi, <%= owner.email %> wants to share '<%= project.name %>' with you. Follow this link to view the project: <%= inviteUrl %> @@ -118,18 +124,14 @@ Thank you #{settings.appName} - <%= siteUrl %> """ - compiledTemplate: _.template """ -

Hi, <%= owner.email %> wants to share '<%= project.name %>' with you

-
- - - View Project - - -
-

Thank you

-

#{settings.appName}

-""" + compiledTemplate: (opts) -> + SingleCTAEmailBody({ + title: "#{ opts.project.name } – shared by #{ opts.owner.email }" + greeting: "Hi," + message: "#{ opts.owner.email } wants to share “#{ opts.project.name }” with you." + ctaURL: opts.inviteUrl + }) + templates.completeJoinGroupAccount = diff --git a/services/web/app/coffee/Features/Email/Layouts/BaseWithHeaderEmailLayout.coffee b/services/web/app/coffee/Features/Email/Layouts/BaseWithHeaderEmailLayout.coffee new file mode 100644 index 0000000000..7b68d3bf49 --- /dev/null +++ b/services/web/app/coffee/Features/Email/Layouts/BaseWithHeaderEmailLayout.coffee @@ -0,0 +1,378 @@ +_ = require("underscore") +settings = require "settings-sharelatex" + +module.exports = _.template """ + + + + + + + + + Project invite + + + + + + + + +
+
+ +
+
+ + +
+
+

+ SHARELATEX +

+
+
+
+
 
+
+
 
+ + <%= body %> + +
+
 
+

ShareLaTeX • www.sharelatex.com

+
+
+ +
+
+ +
                                                           
+ + + +"""