From bc0b75417e95b33d7f2327bc2975c0d615199f68 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Fri, 6 Oct 2023 14:15:04 -0400 Subject: [PATCH] Small improvements to the filter rebalance styling when boolean checkboxes are available (CFM-296) --- app/templates/element/filter.php | 36 +++++++++++++++++++--------- app/templates/element/javascript.php | 11 +++++---- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/app/templates/element/filter.php b/app/templates/element/filter.php index 359c7f749..f772e7648 100644 --- a/app/templates/element/filter.php +++ b/app/templates/element/filter.php @@ -206,7 +206,7 @@ } // Create a text field to hold our date value. - print '
'; + print '
'; print $this->Form->label($key, $label); print '
'; print $this->Form->text($key, $opts) . $this->element('datePicker', $date_args); @@ -243,7 +243,7 @@ } if($options['type'] != 'date') { - print '
'; + print '
'; print $this->Form->control($key, $formParams); print '
'; } @@ -253,7 +253,7 @@
$options): ?> -
+
Form->label(!empty($columns[$key]['label']) ? $columns[$key]['label'] : $key); @@ -359,7 +359,7 @@
- +
>
$options): ?> - -
- > - -
+ +
+ > + +
+ + $options): ?> +
+ > + +
diff --git a/app/templates/element/javascript.php b/app/templates/element/javascript.php index edb71822a..31c1fe604 100644 --- a/app/templates/element/javascript.php +++ b/app/templates/element/javascript.php @@ -166,10 +166,13 @@ } // Toggle the submit container rebalance class so long as there are no datetime pickers - if(!$('.top-filters-fields-dates').length) { - // Count the number of visible fields, and apply the rebalance class on an odd number - if($('#top-filters-fields .filter-active').length % 2 == 1) { - $('#top-filters-submit').addClass("tss-rebalance"); + if(!$('#top-filters-fields .top-filters-fields-dates').length) { + // Count the number of standard visible fields, and apply the rebalance class on an odd number + // unless boolean fields are visible - in which case we remove it. + let standardFiltersCount = $('#top-filters-fields .filter-standard.filter-active').length; + let booleanFiltersCount = $('#top-filters-fields .filter-boolean.filter-active').length; + if(standardFiltersCount % 2 == 1 && !booleanFiltersCount) { + $('#top-filters-submit').addClass("tss-rebalance"); } else { $('#top-filters-submit').removeClass("tss-rebalance"); }