Added editor and mode column to template list.
This commit is contained in:
parent
584be54d47
commit
e2d4073b3e
3 changed files with 22 additions and 4 deletions
|
@ -7,12 +7,22 @@ let tableHelpers = require('../table-helpers');
|
||||||
|
|
||||||
let allowedKeys = ['description', 'editor_name', 'editor_data', 'html', 'text'];
|
let allowedKeys = ['description', 'editor_name', 'editor_data', 'html', 'text'];
|
||||||
|
|
||||||
|
module.exports.editorName = (edt) => {
|
||||||
|
const names = {
|
||||||
|
grapejs: 'GrapesJS',
|
||||||
|
summernote: 'Summernote',
|
||||||
|
codeeditor: 'Code Editor',
|
||||||
|
mosaico: 'Mosaico',
|
||||||
|
};
|
||||||
|
return names[edt] || edt || 'Unknow';
|
||||||
|
}
|
||||||
|
|
||||||
module.exports.list = (start, limit, callback) => {
|
module.exports.list = (start, limit, callback) => {
|
||||||
tableHelpers.list('templates', ['*'], 'name', null, start, limit, callback);
|
tableHelpers.list('templates', ['*'], 'name', null, start, limit, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.filter = (request, parent, callback) => {
|
module.exports.filter = (request, parent, callback) => {
|
||||||
tableHelpers.filter('templates', ['*'], request, ['#', 'name', 'description'], ['name'], 'name ASC', null, callback);
|
tableHelpers.filter('templates', ['*'], request, ['#', 'name', 'editor_name', 'editor_data', 'description'], ['name'], 'name ASC', null, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.quicklist = callback => {
|
module.exports.quicklist = callback => {
|
||||||
|
|
|
@ -179,8 +179,10 @@ router.post('/ajax', (req, res) => {
|
||||||
data: data.map((row, i) => [
|
data: data.map((row, i) => [
|
||||||
(Number(req.body.start) || 0) + 1 + i,
|
(Number(req.body.start) || 0) + 1 + i,
|
||||||
'<span class="glyphicon glyphicon-file" aria-hidden="true"></span> ' + htmlescape(row.name || ''),
|
'<span class="glyphicon glyphicon-file" aria-hidden="true"></span> ' + htmlescape(row.name || ''),
|
||||||
|
templates.editorName(row.editorName),
|
||||||
|
row.editorData && row.editorData.indexOf('"mjml":') > -1 ? 'MJML' : 'HTML',
|
||||||
htmlescape(striptags(row.description) || ''),
|
htmlescape(striptags(row.description) || ''),
|
||||||
'<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span><a href="/templates/edit/' + row.id + '">' + _('Edit') + '</a>' ]
|
'<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span><a href="/templates/edit/' + row.id + '"> ' + _('Edit') + '</a>' ]
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,14 +12,20 @@
|
||||||
<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">
|
<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">
|
||||||
<thead>
|
<thead>
|
||||||
<th style="width: 1%">
|
<th style="width: 1%">
|
||||||
#
|
#
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th style="width: 30%">
|
||||||
{{#translate}}Name{{/translate}}
|
{{#translate}}Name{{/translate}}
|
||||||
</th>
|
</th>
|
||||||
|
<th style="width: 110px">
|
||||||
|
{{#translate}}Editor{{/translate}}
|
||||||
|
</th>
|
||||||
|
<th style="width: 60px">
|
||||||
|
{{#translate}}Mode{{/translate}}
|
||||||
|
</th>
|
||||||
<th>
|
<th>
|
||||||
{{#translate}}Description{{/translate}}
|
{{#translate}}Description{{/translate}}
|
||||||
</th>
|
</th>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue