_ = require('underscore') _.templateSettings = interpolate: /\{\{(.+?)\}\}/g PersonalEmailLayout = require("./Layouts/PersonalEmailLayout") NotificationEmailLayout = require("./Layouts/NotificationEmailLayout") templates = {} templates.welcome = subject: _.template "Welcome to ShareLaTeX" layout: PersonalEmailLayout compiledTemplate: _.template ''' Hi {{first_name}}, thanks for signing up to ShareLaTeX. If you ever get lost, you can log in again here.
I’m the co-founder of ShareLaTeX and I love talking to our users about our service. Please feel free to get in touch by replying to this email and I will get back to you within a day.
Regards,
Henry
ShareLaTeX Co-founder
'''
templates.canceledSubscription =
subject: _.template "ShareLaTeX thoughts"
layout: PersonalEmailLayout
compiledTemplate: _.template '''
Hi {{first_name}},
I am sorry to see you cancelled your premium account. I wondered if you would mind giving me some advice on what the site is lacking at the moment? Criticism from our users about what is missing is the best thing for us to help improve the tool.
Thank you in advance.
Henry
ShareLaTeX Co-founder
'''
templates.passwordReset =
subject: _.template "Password Reset - ShareLatex.com"
layout: NotificationEmailLayout
compiledTemplate: _.template '''
Your password has been reset, the new password is
{{newPassword}}:
please login here and then change your password in your user settings
Thank you
''' templates.projectSharedWithYou = subject: _.template "{{owner.email}} wants to share {{project.name}} with you" layout: NotificationEmailLayout compiledTemplate: _.template '''
Thank you
''' module.exports = buildEmail: (templateName, opts)-> template = templates[templateName] opts.body = template.compiledTemplate(opts) return { subject : template.subject(opts) html: template.layout(opts) }