@@ -10,66 +10,66 @@ var hm_sieve_condition_fields = function() {
1010 description : 'Subject' ,
1111 type : 'string' ,
1212 selected : true ,
13- options : [ 'Contains' , 'Matches' , 'Regex' ]
13+ options : [ 'Contains' , 'Matches' , 'Regex' ] ,
1414 } ,
1515 {
1616 name : 'body' ,
17- description : 'Body ' ,
17+ description : 'Message body ' ,
1818 type : 'string' ,
19- options : [ 'Contains' , 'Matches' , 'Regex' ]
19+ options : [ 'Contains' , 'Matches' , 'Regex' ] ,
2020 } ,
2121 {
2222 name : 'size' ,
2323 description : 'Size (KB)' ,
2424 type : 'int' ,
25- options : [ 'Over' , 'Under' ]
26- }
25+ options : [ 'Over' , 'Under' ] ,
26+ } ,
2727 ] ,
28- ' Header' : [
28+ Header : [
2929 {
3030 name : 'to' ,
31- description : 'To ' ,
31+ description : 'Recipient (To) ' ,
3232 type : 'string' ,
3333 extra_option : false ,
34- options : [ 'Contains' , 'Matches' , 'Regex' ]
34+ options : [ 'Contains' , 'Matches' , 'Regex' ] ,
3535 } ,
3636 {
3737 name : 'from' ,
38- description : 'From' ,
38+ description : 'Sender ( From) ' ,
3939 type : 'string' ,
4040 extra_option : false ,
41- options : [ 'Contains' , 'Matches' , 'Regex' ]
41+ options : [ 'Contains' , 'Matches' , 'Regex' ] ,
4242 } ,
4343 {
4444 name : 'cc' ,
45- description : 'CC ' ,
45+ description : 'Copied recipient (CC) ' ,
4646 type : 'string' ,
4747 extra_option : false ,
48- options : [ 'Contains' , 'Matches' , 'Regex' ]
48+ options : [ 'Contains' , 'Matches' , 'Regex' ] ,
4949 } ,
5050 {
5151 name : 'to_or_cc' ,
52- description : 'To or CC' ,
52+ description : 'Recipient ( To or CC) ' ,
5353 type : 'string' ,
5454 extra_option : false ,
55- options : [ 'Contains' , 'Matches' , 'Regex' ]
55+ options : [ 'Contains' , 'Matches' , 'Regex' ] ,
5656 } ,
5757 {
5858 name : 'bcc' ,
59- description : 'BCC' ,
59+ description : 'Blind copied recipient ( BCC) ' ,
6060 type : 'string' ,
6161 extra_option : false ,
62- options : [ 'Contains' , 'Matches' , 'Regex' ]
62+ options : [ 'Contains' , 'Matches' , 'Regex' ] ,
6363 } ,
6464 {
6565 name : 'custom' ,
6666 description : 'Custom' ,
6767 type : 'string' ,
6868 extra_option : true ,
6969 extra_option_description : 'Field Name' ,
70- options : [ 'Contains' , 'Matches' , 'Regex' ]
71- }
72- ]
70+ options : [ 'Contains' , 'Matches' , 'Regex' ] ,
71+ } ,
72+ ] ,
7373 } ;
7474} ;
7575
@@ -700,6 +700,19 @@ function sieveFiltersPageHandler() {
700700 add_filter_match_mode ( ) ;
701701 } ) ;
702702
703+ /**
704+ * Actions Drag and Drop
705+ */
706+ const actionsTbody = document . querySelector ( ".filter_actions_modal_table" ) ;
707+
708+ if ( actionsTbody ) {
709+ new Sortable ( actionsTbody , {
710+ handle : ".drag-handle" ,
711+ animation : 150 ,
712+ ghostClass : "sortable-ghost" ,
713+ } ) ;
714+ }
715+
703716 function add_filter_action ( default_value = '' ) {
704717 let possible_actions_html = '' ;
705718
@@ -711,21 +724,25 @@ function sieveFiltersPageHandler() {
711724 possible_actions_html += '<option value="' + value . name + '">' + value . description + '</option>' ;
712725 } ) ;
713726 let extra_options = '<td class="col-sm-3"><input type="hidden" class="condition_extra_action_value form-control form-control-sm" name="sieve_selected_extra_action_value[]" /></td>' ;
714- $ ( '.filter_actions_modal_table' ) . append (
715- '<tr class="border" default_value="' + default_value + '">' +
716- ' <td class="col-sm-3">' +
717- ' <select class="sieve_actions_select form-control form-control-sm" name="sieve_selected_actions[]">' +
718- ' ' + possible_actions_html +
719- ' </select>' +
720- ' </td>' +
721- extra_options +
722- ' <td class="col-sm-5">' +
723- ' <input type="hidden" name="sieve_selected_action_value[]" value="">' +
724- ' </input>' +
725- ' <td class="col-sm-1 text-end align-middle">' +
726- ' <a href="#" class="delete_action_modal_button btn btn-sm btn-secondary">Delete</a>' +
727- ' </td>' +
728- '</tr>'
727+ $ ( ".filter_actions_modal_table" ) . append (
728+ '<tr class="border draggable_action_row" default_value="' +
729+ default_value +
730+ '">' +
731+ ' <td class="col-sm-1 drag-handle" style="cursor: grab;">☰</td>' +
732+ ' <td class="col-sm-3">' +
733+ ' <select class="sieve_actions_select form-control form-control-sm" name="sieve_selected_actions[]">' +
734+ " " +
735+ possible_actions_html +
736+ " </select>" +
737+ " </td>" +
738+ extra_options +
739+ ' <td class="col-sm-5">' +
740+ ' <input type="hidden" name="sieve_selected_action_value[]" value="">' +
741+ " </input>" +
742+ ' <td class="col-sm-1 text-end align-middle">' +
743+ ' <a href="#" class="delete_action_modal_button btn btn-sm btn-secondary">Delete</a>' +
744+ " </td>" +
745+ "</tr>"
729746 ) ;
730747 }
731748
0 commit comments