Lists and Templates overviews refactored to use ajax. Before the refactoring, they behaved and looked a bit different to the other (Ajax) tables. The main difference in the behavior was in the row numbers (1st column) when sort order was switched. The non-ajax tables rearranged the numbers in the 1st column while the ajax-tables didn't.

Some small tweaks in table-helpers to allow selecting which fields are pulled from DB (and how they are renamed).
This commit is contained in:
Tomas Bures 2017-04-16 03:22:32 -04:00
parent e5190c9b20
commit 9fdf52674e
12 changed files with 246 additions and 192 deletions

View file

@ -21,7 +21,7 @@ module.exports.list = (listId, start, limit, callback) => {
return callback(new Error('Missing List ID'));
}
tableHelpers.list('subscription__' + listId, 'email', start, limit, (err, rows, total) => {
tableHelpers.list('subscription__' + listId, ['*'], 'email', start, limit, (err, rows, total) => {
if (!err) {
rows = rows.map(row => tools.convertKeys(row));
}
@ -80,10 +80,10 @@ module.exports.filter = (listId, request, columns, segmentId, callback) => {
return callback(err);
}
tableHelpers.filter('subscription__' + listId, request, columns, ['email', 'first_name', 'last_name'], 'email ASC', queryData, callback);
tableHelpers.filter('subscription__' + listId, ['*'], request, columns, ['email', 'first_name', 'last_name'], 'email ASC', queryData, callback);
});
} else {
tableHelpers.filter('subscription__' + listId, request, columns, ['email', 'first_name', 'last_name'], 'email ASC', null, callback);
tableHelpers.filter('subscription__' + listId, ['*'], request, columns, ['email', 'first_name', 'last_name'], 'email ASC', null, callback);
}
};