_ = require('underscore') PersonalEmailLayout = require("./Layouts/PersonalEmailLayout") NotificationEmailLayout = require("./Layouts/NotificationEmailLayout") settings = require("settings-sharelatex") templates = {} templates.registered = subject: _.template "Activate your #{settings.appName} Account" layout: PersonalEmailLayout type: "notification" plainTextTemplate: _.template """ Congratulations, you've just had an account created for you on #{settings.appName} with the email address "<%= to %>". Click here to set your password and log in: <%= setNewPasswordUrl %> If you have any questions or problems, please contact #{settings.adminEmail} """ compiledTemplate: _.template """

Congratulations, you've just had an account created for you on #{settings.appName} with the email address "<%= to %>".

Click here to set your password and log in.

If you have any questions or problems, please contact #{settings.adminEmail}.

""" templates.canceledSubscription = subject: _.template "ShareLaTeX thoughts" layout: PersonalEmailLayout type:"lifecycle" plainTextTemplate: _.template """ Hi <%= first_name %>, 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 this survey?: https://sharelatex.typeform.com/to/f5lBiZ Thank you in advance. Henry ShareLaTeX Co-founder """ compiledTemplate: _.template '''

Hi <%= first_name %>,

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 this survey?

Thank you in advance.

Henry
ShareLaTeX Co-founder

''' templates.passwordResetRequested = subject: _.template "Password Reset - #{settings.appName}" layout: NotificationEmailLayout type:"notification" plainTextTemplate: _.template """ Password Reset We got a request to reset your #{settings.appName} password. Click this link to reset your password: <%= setNewPasswordUrl %> If you ignore this message, your password won't be changed. If you didn't request a password reset, let us know. Thank you #{settings.appName} - <%= siteUrl %> """ compiledTemplate: _.template """

Password Reset

We got a request to reset your #{settings.appName} password.

Reset password
If you ignore this message, your password won't be changed.

If you didn't request a password reset, let us know.

Thank you

#{settings.appName}

""" templates.projectSharedWithYou = subject: _.template "<%= owner.email %> wants to share <%= project.name %> with you" layout: NotificationEmailLayout type:"notification" plainTextTemplate: _.template """ Hi, <%= owner.email %> wants to share '<%= project.name %>' (<%= project.url %>) with you. Click this link to view the project: <%= project.url %> Thank you #{settings.appName} - <%= siteUrl %> """ compiledTemplate: _.template """

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

View Project

Thank you

#{settings.appName}

""" templates.projectInvite = subject: _.template "<%= project.name %> - shared by <%= owner.email %>" layout: NotificationEmailLayout type:"notification" plainTextTemplate: _.template """ Hi, <%= owner.email %> wants to share '<%= project.name %>' with you. Follow this link to view the project: <%= inviteUrl %> Thank you #{settings.appName} - <%= siteUrl %> """ compiledTemplate: _.template """

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

View Project

Thank you

#{settings.appName}

""" templates.completeJoinGroupAccount = subject: _.template "Verify Email to join <%= group_name %> group" layout: NotificationEmailLayout type:"notification" plainTextTemplate: _.template """ Hi, please verify your email to join the <%= group_name %> and get your free premium account Click this link to verify now: <%= completeJoinUrl %> Thank You #{settings.appName} - <%= siteUrl %> """ compiledTemplate: _.template """

Hi, please verify your email to join the <%= group_name %> and get your free premium account

Verify now

Thank you

#{settings.appName}

""" module.exports = templates: templates buildEmail: (templateName, opts)-> template = templates[templateName] opts.siteUrl = settings.siteUrl opts.body = template.compiledTemplate(opts) if settings.email?.templates?.customFooter? opts.body += settings.email?.templates?.customFooter return { subject : template.subject(opts) html: template.layout(opts) text: template?.plainTextTemplate?(opts) type:template.type }