diff --git a/routes/templates.js b/routes/templates.js index eb3066e2..56749699 100644 --- a/routes/templates.js +++ b/routes/templates.js @@ -24,7 +24,8 @@ router.all('/*', (req, res, next) => { router.get('/', (req, res) => { res.render('templates/templates', { - title: _('Templates') + title: _('Templates'), + showEditor: config.views.template.showeditor || false }); }); @@ -176,14 +177,24 @@ router.post('/ajax', (req, res) => { draw: req.body.draw, recordsTotal: total, recordsFiltered: filteredTotal, - data: data.map((row, i) => [ - (Number(req.body.start) || 0) + 1 + i, - ' ' + htmlescape(row.name || ''), - templates.editorName(row.editorName), - row.editorData && row.editorData.indexOf('"mjml":') > -1 ? 'MJML' : 'HTML', - htmlescape(striptags(row.description) || ''), - ' ' + _('Edit') + '' ] - ) + data: data.map((row, i) => { + let templateRow = [ + (Number(req.body.start) || 0) + 1 + i, + ' ' + htmlescape(row.name || '') + ]; + if (config.views.template.showeditor) { + templateRow.push( + templates.editorName(row.editorName), + row.editorData && row.editorData.indexOf('"mjml":') > -1 ? 'MJML' : 'HTML' + ); + } + templateRow.push( + htmlescape(striptags(row.description) || ''), + ' ' + _('Edit') + '' + ); + return templateRow; + + }) }); }); }); diff --git a/views/templates/templates.hbs b/views/templates/templates.hbs index d53db1ab..036973cf 100644 --- a/views/templates/templates.hbs +++ b/views/templates/templates.hbs @@ -12,7 +12,7 @@
- +
+ {{#if showEditor}} + {{/if}}
# @@ -20,12 +20,14 @@ {{#translate}}Name{{/translate}} {{#translate}}Editor{{/translate}} {{#translate}}Mode{{/translate}} {{#translate}}Description{{/translate}}