From e923a92b50c1238f5e9760b3744ccac8a0602c02 Mon Sep 17 00:00:00 2001 From: Luke Carbis Date: Wed, 2 Nov 2016 10:19:54 +1000 Subject: [PATCH] Fix action dropdown, update values based on context --- ui/js/alerts.js | 1 - ui/js/exclude.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/ui/js/alerts.js b/ui/js/alerts.js index 2a008f547..51e30be97 100644 --- a/ui/js/alerts.js +++ b/ui/js/alerts.js @@ -56,7 +56,6 @@ jQuery( function( $ ) { var parts = value.split( '-' ); $( this ).siblings( '.connector' ).val( parts[0] ); $( this ).siblings( '.context' ).val( parts[1] ); - // $(this).removeAttr('name'); } }); diff --git a/ui/js/exclude.js b/ui/js/exclude.js index 71091e8d8..0f52bd250 100644 --- a/ui/js/exclude.js +++ b/ui/js/exclude.js @@ -48,6 +48,14 @@ jQuery( function( $ ) { return null; } + }).on( 'change', function() { + var row = $( this ).closest( 'tr' ), + connector = $( this ).val(); + if ( connector && 0 < connector.indexOf( '-' ) ) { + var connector_split = connector.split( '-' ); + connector = connector_split[0]; + } + getActions( row, connector ); }); }); @@ -323,6 +331,40 @@ jQuery( function( $ ) { recalculate_rules_selected(); }); + function getActions( row, connector ) { + var trigger_action = $( '.select2-select.action', row ), + action_value = trigger_action.val(); + + trigger_action.empty(); + trigger_action.prop( 'disabled', true ); + + var placeholder = $( '