From a5d96f1534203f10c68d57e0305ff21d1f6eb589 Mon Sep 17 00:00:00 2001 From: Jonathan Labreuille Date: Wed, 25 Nov 2015 18:31:57 +0100 Subject: [PATCH] WP Users list - refactored and fixed listing issues (related to Segments) - removed bulk actions from segments - added synchronize methods for WP users - Update action in segments only for WP Users list - added "type" column to segments (default, wp_users, dynamic...) - added "status" column to subscriber_segment table (useful soon) --- assets/js/src/forms/list.jsx | 3 ++ assets/js/src/listing/listing.jsx | 49 ++++++++++++--------------- assets/js/src/newsletters/list.jsx | 3 ++ assets/js/src/segments/list.jsx | 37 ++++++++++++--------- assets/js/src/subscribers/list.jsx | 16 +++++++++ lib/Config/Hooks.php | 12 +++---- lib/Config/Migrator.php | 30 ++--------------- lib/Models/Segment.php | 15 ++++++++- lib/Router/Segments.php | 25 ++++++-------- lib/{Filters => Segments}/WP.php | 53 ++++++++++++++++++++++++------ views/form/editor.html | 14 +++++--- 11 files changed, 150 insertions(+), 107 deletions(-) rename lib/{Filters => Segments}/WP.php (61%) diff --git a/assets/js/src/forms/list.jsx b/assets/js/src/forms/list.jsx index c11a6b1f72..b9a62fcf45 100644 --- a/assets/js/src/forms/list.jsx +++ b/assets/js/src/forms/list.jsx @@ -105,6 +105,9 @@ const item_actions = [ refresh(); }); } + }, + { + name: 'trash' } ]; diff --git a/assets/js/src/listing/listing.jsx b/assets/js/src/listing/listing.jsx index 804f13c82b..d7495133b1 100644 --- a/assets/js/src/listing/listing.jsx +++ b/assets/js/src/listing/listing.jsx @@ -79,33 +79,48 @@ define( if(custom_actions.length > 0) { item_actions = custom_actions.map(function(action, index) { - if(action.onFilter !== undefined) { - if(action.onFilter(this.props.item) === false) { + if(action.display !== undefined) { + if(action.display(this.props.item) === false) { return; } } - if(action.refresh) { + if(action.name === 'trash') { + return ( + + {(index > 0) ? ' | ' : ''} + + Trash + + + ); + } else if(action.refresh) { return ( + {(index > 0) ? ' | ' : ''} { action.link(this.props.item) } - {(index < (custom_actions.length - 1)) ? ' | ' : ''} ); } else if(action.link) { return ( + {(index > 0) ? ' | ' : ''} { action.link(this.props.item) } - {(index < (custom_actions.length - 1)) ? ' | ' : ''} ); } else { return ( + {(index > 0) ? ' | ' : ''} { action.label } - {(index < (custom_actions.length - 1)) ? ' | ' : ''} ); } @@ -127,12 +141,6 @@ define( ); } - var is_readonly = ( - (this.props.onFilterItem !== undefined) - ? this.props.onFilterItem(this.props.item) - : false - ); - if(this.props.group === 'trash') { var actions = (
@@ -170,19 +178,6 @@ define(
{ item_actions } - { (is_readonly) ? '' : ( - - { ' | ' } - - Trash - - - )}