2014-03-04 13:10:06 -05:00
_ = require ( ' underscore ' )
PersonalEmailLayout = require ( " ./Layouts/PersonalEmailLayout " )
NotificationEmailLayout = require ( " ./Layouts/NotificationEmailLayout " )
2014-06-17 11:28:52 -04:00
settings = require ( " settings-sharelatex " )
2014-03-04 13:10:06 -05:00
2016-06-28 12:07:27 -04:00
2014-03-04 13:10:06 -05:00
templates = { }
2016-08-03 09:06:08 -04:00
templates.registered =
2015-03-19 10:22:48 -04:00
subject: _ . template " Activate your #{ settings . appName } Account "
2014-03-04 13:10:06 -05:00
layout: PersonalEmailLayout
2015-03-19 10:22:48 -04:00
type: " notification "
compiledTemplate: _ . template """
< p > Congratulations , you ' ve just had an account created for you on # {settings.appName} with the email address " <%= to %> " .</p>
2014-10-16 07:46:38 -04:00
2015-03-19 10:22:48 -04:00
< p > < a href = " <%= setNewPasswordUrl %> " > Click here to set your password and log in . < / a > < / p >
2014-03-04 13:10:06 -05:00
2015-03-19 10:22:48 -04:00
< p > If you have any questions or problems , please contact < a href = " mailto: #{ settings . adminEmail } " > #{settings.adminEmail}</a>.</p>
"""
2014-03-04 13:10:06 -05:00
2016-08-03 09:06:08 -04:00
templates.canceledSubscription =
2014-03-04 13:10:06 -05:00
subject: _ . template " ShareLaTeX thoughts "
layout: PersonalEmailLayout
2014-03-05 06:22:34 -05:00
type : " lifecycle "
2014-03-04 13:10:06 -05:00
compiledTemplate: _ . template '''
2014-10-16 07:46:38 -04:00
< p > Hi < %= first_name % > , < / p >
2014-03-04 13:10:06 -05:00
2015-05-29 11:27:35 -04:00
< p > I ' m sorry to see you cancelled your ShareLaTeX premium account. Would you mind giving me some advice on what the site is lacking at the moment via <a href= " https://sharelatex.typeform.com/to/F7OzIY " >this survey</a>?</p>
2014-03-04 13:10:06 -05:00
2014-10-16 07:46:38 -04:00
< p > Thank you in advance . < / p >
2014-03-04 13:10:06 -05:00
< p >
Henry < br >
ShareLaTeX Co - founder
2014-10-16 07:46:38 -04:00
< / p >
2014-03-04 13:10:06 -05:00
'''
2016-08-03 09:06:08 -04:00
templates.passwordResetRequested =
2015-03-19 10:22:48 -04:00
subject: _ . template " Password Reset - #{ settings . appName } "
2014-03-04 13:10:06 -05:00
layout: NotificationEmailLayout
2014-03-05 06:22:34 -05:00
type : " notification "
2015-03-19 10:22:48 -04:00
compiledTemplate: _ . template """
< h2 > Password Reset < / h2 >
2014-03-04 13:10:06 -05:00
< p >
2015-03-19 10:22:48 -04:00
We got a request to reset your #{settings.appName} password.
2014-03-05 10:45:24 -05:00
< p >
2014-05-15 12:58:25 -04:00
< center >
2015-03-19 10:22:48 -04:00
< div style = " width:200px;background-color: # a93629;border:1px solid # e24b3b;border-radius:3px;padding:15px; margin:24px; " >
2014-05-15 12:58:25 -04:00
< div style = " padding-right:10px;padding-left:10px " >
< a href = " <%= setNewPasswordUrl %> " style = " text-decoration:none " target = " _blank " >
< span style= " font-size:16px;font-family:Arial;font-weight:bold;color: # fff;white-space:nowrap;display:block; text-align:center " >
Reset password
< / span >
< / a >
< / div >
< / div >
< / center >
If you ignore this message , your password won ' t be changed.
< p >
If you didn ' t request a password reset, let us know.
2014-03-04 13:10:06 -05:00
< / p >
< p > Thank you < / p >
2015-03-19 10:22:48 -04:00
< p > < a href = " <%= siteUrl %> " > #{settings.appName}</a></p>
"""
2014-03-04 13:10:06 -05:00
2016-08-03 09:06:08 -04:00
templates.projectSharedWithYou =
2014-03-06 07:28:07 -05:00
subject: _ . template " <%= owner.email %> wants to share <%= project.name %> with you "
2014-03-04 13:10:06 -05:00
layout: NotificationEmailLayout
2014-03-05 06:22:34 -05:00
type : " notification "
2015-03-19 10:22:48 -04:00
compiledTemplate: _ . template """
2014-07-21 09:18:11 -04:00
< p > Hi , < %= owner . email % > wants to share < a href = " <%= project.url %> " > ' <%= project.name %> ' < / a > with you < / p >
2014-03-04 13:10:06 -05:00
< center >
2015-03-19 10:22:48 -04:00
< div style = " width:200px;background-color: # a93629;border:1px solid # e24b3b;border-radius:3px;padding:15px; margin:24px; " >
2014-03-04 13:10:06 -05:00
< div style = " padding-right:10px;padding-left:10px " >
2014-03-06 07:28:07 -05:00
< a href = " <%= project.url %> " style = " text-decoration:none " target = " _blank " >
2014-07-21 09:18:11 -04:00
< span style= " font-size:16px;font-family:Helvetica,Arial;font-weight:400;color: # fff;white-space:nowrap;display:block; text-align:center " >
2014-03-04 13:10:06 -05:00
View Project
< / span >
< / a >
< / div >
< / div >
< / center >
< p > Thank you < / p >
2015-03-19 10:22:48 -04:00
< p > < a href = " <%= siteUrl %> " > #{settings.appName}</a></p>
"""
2014-03-04 13:10:06 -05:00
2016-07-21 10:56:41 -04:00
templates.projectInvite =
2016-08-03 09:06:08 -04:00
subject: _ . template " <%= project.name %> - shared by <%= owner.email %> "
2016-07-21 10:56:41 -04:00
layout: NotificationEmailLayout
type : " notification "
compiledTemplate: _ . template """
< p > Hi , < %= owner . email % > wants to share < a href = " <%= project.url %> " > ' <%= project.name %> ' < / a > with you < / p >
< center >
< div style = " width:200px;background-color: # a93629;border:1px solid # e24b3b;border-radius:3px;padding:15px; margin:24px; " >
< div style = " padding-right:10px;padding-left:10px " >
< a href = " <%= inviteUrl %> " style = " text-decoration:none " target = " _blank " >
< span style= " font-size:16px;font-family:Helvetica,Arial;font-weight:400;color: # fff;white-space:nowrap;display:block; text-align:center " >
2016-08-03 09:06:08 -04:00
View Project
2016-07-21 10:56:41 -04:00
< / span >
< / a >
< / div >
< / div >
< / center >
< p > Thank you < / p >
< p > < a href = " <%= siteUrl %> " > #{settings.appName}</a></p>
"""
2015-05-22 08:57:15 -04:00
2016-08-03 09:06:08 -04:00
templates.completeJoinGroupAccount =
2015-05-22 08:57:15 -04:00
subject: _ . template " Verify Email to join <%= group_name %> group "
layout: NotificationEmailLayout
type : " notification "
compiledTemplate: _ . template """
< p > Hi , please verify your email to join the < %= group_name % > and get your free premium account < / p >
< center >
< div style = " width:200px;background-color: # a93629;border:1px solid # e24b3b;border-radius:3px;padding:15px; margin:24px; " >
< div style = " padding-right:10px;padding-left:10px " >
< a href = " <%= completeJoinUrl %> " style = " text-decoration:none " target = " _blank " >
< span style= " font-size:16px;font-family:Helvetica,Arial;font-weight:400;color: # fff;white-space:nowrap;display:block; text-align:center " >
Verify now
< / span >
< / a >
< / div >
< / div >
< / center >
< p > Thank you < / p >
< p > < a href = " <%= siteUrl %> " > #{settings.appName}</a></p>
"""
2014-03-04 13:10:06 -05:00
module.exports =
2015-03-19 13:19:56 -04:00
templates: templates
2014-03-04 13:10:06 -05:00
buildEmail: (templateName, opts)->
template = templates [ templateName ]
2014-06-17 11:28:52 -04:00
opts.siteUrl = settings . siteUrl
2014-03-04 13:10:06 -05:00
opts.body = template . compiledTemplate ( opts )
2016-06-28 12:07:27 -04:00
if settings . email ? . templates ? . customFooter ?
opts . body += settings . email ? . templates ? . customFooter
2014-03-04 13:10:06 -05:00
return {
subject : template . subject ( opts )
html: template . layout ( opts )
2014-03-05 06:22:34 -05:00
type : template . type
2014-03-04 13:10:06 -05:00
}