|
|
@ -10,6 +10,7 @@ var fs = require('fs'),
|
|
|
|
Plugins = require('./plugins'),
|
|
|
|
Plugins = require('./plugins'),
|
|
|
|
meta = require('./meta'),
|
|
|
|
meta = require('./meta'),
|
|
|
|
translator = require('../public/src/modules/translator'),
|
|
|
|
translator = require('../public/src/modules/translator'),
|
|
|
|
|
|
|
|
tjs = require('templates.js'),
|
|
|
|
|
|
|
|
|
|
|
|
app;
|
|
|
|
app;
|
|
|
|
|
|
|
|
|
|
|
@ -48,11 +49,11 @@ var fs = require('fs'),
|
|
|
|
function renderAndTranslate(tpl, params, callback) {
|
|
|
|
function renderAndTranslate(tpl, params, callback) {
|
|
|
|
async.waterfall([
|
|
|
|
async.waterfall([
|
|
|
|
function(next) {
|
|
|
|
function(next) {
|
|
|
|
app.render('emails/partials/footer' + (tpl.indexOf('_plaintext') !== -1 ? '_plaintext' : ''), params, next);
|
|
|
|
render('emails/partials/footer' + (tpl.indexOf('_plaintext') !== -1 ? '_plaintext' : ''), params, next);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
function(footer, next) {
|
|
|
|
function(footer, next) {
|
|
|
|
params.footer = footer;
|
|
|
|
params.footer = footer;
|
|
|
|
app.render(tpl, params, next);
|
|
|
|
render(tpl, params, next);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
function(html, next) {
|
|
|
|
function(html, next) {
|
|
|
|
translator.translate(html, lang, function(translated) {
|
|
|
|
translator.translate(html, lang, function(translated) {
|
|
|
@ -62,6 +63,15 @@ var fs = require('fs'),
|
|
|
|
], callback);
|
|
|
|
], callback);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function render(tpl, params, next) {
|
|
|
|
|
|
|
|
if (meta.config['email:custom:' + tpl.replace('emails/', '')]) {
|
|
|
|
|
|
|
|
var text = templates.parse(meta.config['email:custom:' + tpl.replace('emails/', '')], params);
|
|
|
|
|
|
|
|
next(null, text);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
app.render(tpl, params, next);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
callback = callback || function() {};
|
|
|
|
callback = callback || function() {};
|
|
|
|
|
|
|
|
|
|
|
|
if (!Plugins.hasListeners('action:email.send')) {
|
|
|
|
if (!Plugins.hasListeners('action:email.send')) {
|
|
|
|