Option to show editor and mode to templates list

This commit is contained in:
Dominique Da Silva 2019-11-09 00:55:40 +00:00
parent 7be9624789
commit d481674e86
2 changed files with 23 additions and 10 deletions

View file

@ -24,7 +24,8 @@ router.all('/*', (req, res, next) => {
router.get('/', (req, res) => { router.get('/', (req, res) => {
res.render('templates/templates', { 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, draw: req.body.draw,
recordsTotal: total, recordsTotal: total,
recordsFiltered: filteredTotal, recordsFiltered: filteredTotal,
data: data.map((row, i) => [ data: data.map((row, i) => {
(Number(req.body.start) || 0) + 1 + i, let templateRow = [
'<span class="glyphicon glyphicon-file" aria-hidden="true"></span> ' + htmlescape(row.name || ''), (Number(req.body.start) || 0) + 1 + i,
templates.editorName(row.editorName), '<span class="glyphicon glyphicon-file" aria-hidden="true"></span> ' + htmlescape(row.name || '')
row.editorData && row.editorData.indexOf('"mjml":') > -1 ? 'MJML' : 'HTML', ];
htmlescape(striptags(row.description) || ''), if (config.views.template.showeditor) {
'<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span><a href="/templates/edit/' + row.id + '"> ' + _('Edit') + '</a>' ] templateRow.push(
) templates.editorName(row.editorName),
row.editorData && row.editorData.indexOf('"mjml":') > -1 ? 'MJML' : 'HTML'
);
}
templateRow.push(
htmlescape(striptags(row.description) || ''),
'<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span><a href="/templates/edit/' + row.id + '"> ' + _('Edit') + '</a>'
);
return templateRow;
})
}); });
}); });
}); });

View file

@ -12,7 +12,7 @@
<hr> <hr>
<div class="table-responsive"> <div class="table-responsive">
<table data-topic-url="/templates" data-sort-column="1" data-sort-order="asc" class="table table-bordered table-hover data-table-ajax display nowrap" width="100%" data-row-sort="0,1,0,0,0,0"> <table data-topic-url="/templates" data-sort-column="1" data-sort-order="asc" class="table table-bordered table-hover data-table-ajax display nowrap" width="100%" data-row-sort="0,1,{{#if showEditor}}0,0,{{/if}}0,0">
<thead> <thead>
<th style="width: 1%"> <th style="width: 1%">
# #
@ -20,12 +20,14 @@
<th style="width: 30%"> <th style="width: 30%">
{{#translate}}Name{{/translate}} {{#translate}}Name{{/translate}}
</th> </th>
{{#if showEditor}}
<th style="width: 110px"> <th style="width: 110px">
{{#translate}}Editor{{/translate}} {{#translate}}Editor{{/translate}}
</th> </th>
<th style="width: 60px"> <th style="width: 60px">
{{#translate}}Mode{{/translate}} {{#translate}}Mode{{/translate}}
</th> </th>
{{/if}}
<th> <th>
{{#translate}}Description{{/translate}} {{#translate}}Description{{/translate}}
</th> </th>