Bulk actions + Extra data

- fixed issue on bulk action being run even without any items selected
- added WP like feature regarding item selection, if all items are checked, it also checks the header/footer checkboxes
- fixed issue where the selection state was not properly reset
- added List column to subscribers
- added json_encode/json_decode to Twig
This commit is contained in:
Jonathan Labreuille
2015-09-23 14:13:25 +02:00
parent 239e2583d2
commit 56e40feb56
8 changed files with 113 additions and 9 deletions

View File

@@ -27,7 +27,21 @@ class Subscribers {
\Model::factory('\MailPoet\Models\Subscriber'),
$data
);
wp_send_json($listing->get());
$listing_data = $listing->get();
// fetch segments relations for each returned item
foreach($listing_data['items'] as &$item) {
$segments = SubscriberSegment::select('segment_id')
->where('subscriber_id', $item['id'])
->findMany();
$item['segments'] = array_map(function($relation) {
return $relation->segment_id;
}, $segments);
}
wp_send_json($listing_data);
}
function getAll() {