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:
parent
e5190c9b20
commit
9fdf52674e
12 changed files with 246 additions and 192 deletions
|
@ -19,7 +19,7 @@ let tableHelpers = require('../table-helpers');
|
|||
let allowedKeys = ['description', 'from', 'address', 'reply_to', 'subject', 'editor_name', 'editor_data', 'template', 'source_url', 'list', 'segment', 'html', 'text', 'tracking_disabled'];
|
||||
|
||||
module.exports.list = (start, limit, callback) => {
|
||||
tableHelpers.list('campaigns', 'scheduled', start, limit, callback);
|
||||
tableHelpers.list('campaigns', ['*'], 'scheduled', start, limit, callback);
|
||||
};
|
||||
|
||||
module.exports.filter = (request, parent, callback) => {
|
||||
|
@ -38,7 +38,7 @@ module.exports.filter = (request, parent, callback) => {
|
|||
};
|
||||
}
|
||||
|
||||
tableHelpers.filter('campaigns', request, ['#', 'name', 'description', 'status', 'created'], ['name'], 'created DESC', queryData, callback);
|
||||
tableHelpers.filter('campaigns', ['*'], request, ['#', 'name', 'description', 'status', 'created'], ['name'], 'created DESC', queryData, callback);
|
||||
};
|
||||
|
||||
module.exports.filterClickedSubscribers = (campaign, linkId, request, columns, callback) => {
|
||||
|
@ -47,7 +47,7 @@ module.exports.filterClickedSubscribers = (campaign, linkId, request, columns, c
|
|||
values: [campaign.list, linkId]
|
||||
};
|
||||
|
||||
tableHelpers.filter('subscription__' + campaign.list + ' JOIN campaign_tracker__' + campaign.id + ' ON campaign_tracker__' + campaign.id + '.subscriber=subscription__' + campaign.list + '.id', request, columns, ['email', 'first_name', 'last_name'], 'email ASC', queryData, callback);
|
||||
tableHelpers.filter('subscription__' + campaign.list + ' JOIN campaign_tracker__' + campaign.id + ' ON campaign_tracker__' + campaign.id + '.subscriber=subscription__' + campaign.list + '.id', ['*'], request, columns, ['email', 'first_name', 'last_name'], 'email ASC', queryData, callback);
|
||||
};
|
||||
|
||||
module.exports.statsClickedSubscribersByColumn = (campaign, linkId, request, column, limit, callback) => {
|
||||
|
@ -92,7 +92,7 @@ module.exports.filterStatusSubscribers = (campaign, status, request, columns, ca
|
|||
values: [campaign.list, campaign.segment && campaign.segment.id || 0, status]
|
||||
};
|
||||
|
||||
tableHelpers.filter('subscription__' + campaign.list + ' JOIN campaign__' + campaign.id + ' ON campaign__' + campaign.id + '.subscription=subscription__' + campaign.list + '.id', request, columns, ['email', 'first_name', 'last_name'], 'email ASC', queryData, callback);
|
||||
tableHelpers.filter('subscription__' + campaign.list + ' JOIN campaign__' + campaign.id + ' ON campaign__' + campaign.id + '.subscription=subscription__' + campaign.list + '.id', ['*'], request, columns, ['email', 'first_name', 'last_name'], 'email ASC', queryData, callback);
|
||||
};
|
||||
|
||||
module.exports.getByCid = (cid, callback) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue