Merge tag reference abstraction/partial

Perhaps helpers.js would be a more suitable place for
getDefaultMergeTags() and getListMergeTags() … ?
This commit is contained in:
witzig 2017-03-04 18:37:41 +01:00
parent 9f191bd7da
commit 633463108e
8 changed files with 149 additions and 238 deletions

View file

@ -111,12 +111,21 @@ router.get('/edit/:id', passport.csrfProtection, (req, res, next) => {
if (err) {
return next(err);
}
template.csrfToken = req.csrfToken();
template.useEditor = true;
template.editorName = template.editorName || 'summernote';
template.editorConfig = config[template.editorName];
template.disableWysiwyg = configItems.disableWysiwyg;
res.render('templates/edit', template);
tools.getDefaultMergeTags((err, defaultMergeTags) => {
if (err) {
req.flash('danger', err.message || err);
return res.redirect('/templates');
}
template.mergeTags = defaultMergeTags;
template.csrfToken = req.csrfToken();
template.useEditor = true;
template.editorName = template.editorName || 'summernote';
template.editorConfig = config[template.editorName];
template.disableWysiwyg = configItems.disableWysiwyg;
res.render('templates/edit', template);
});
});
});
});