Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.0.6 #154

Closed
wants to merge 17 commits into from
Closed
Prev Previous commit
Next Next commit
fix filter not working on tag screen
  • Loading branch information
deji98 committed Jan 10, 2025
commit c14ab3eb0f4caeee91ebd5e1c7a7d3955cc17548
33 changes: 22 additions & 11 deletions views/partials/filter_admin_footer.view.php
Original file line number Diff line number Diff line change
@@ -6,22 +6,33 @@
<script>
jQuery(document).ready(function () {
var sel_filter;
var container;

// check if we have an bulk action menu
if (jQuery("select[name='term-group-top']").length){
sel_filter = jQuery("<select id='tag_filter' name='term-filter' style='margin-left: 20px;'>").insertAfter("select[name='term-group-top']");
if (jQuery("select[name='term-group-top']").length) {
// Create a container for the filter dropdown and button
container = jQuery("<div>").attr("id", "filter_container").css({float: "right",marginLeft: "10px",}).insertAfter("select[name='term-group-top']");
} else {
sel_filter = jQuery("<select id='tag_filter' name='term-filter' style='margin-left: 20px;'>").insertAfter("select[name='action']");
container = jQuery("<div>").attr("id", "filter_container").css({float: "right",marginLeft: "10px",}).insertAfter("select[name='action']");
}
sel_filter = jQuery("<select>").attr("id", "tag_filter").attr("name", "term-filter").css("margin-right", "5px").appendTo(container);

sel_filter.append(jQuery("<option>").attr("value", "-1").html("<?php
_e( 'Filter off', 'tag-groups' )
?>"));
<?php foreach ( $term_groups as $term_group ) :
$bg_color = in_array( $term_group['term_group'], $parents ) ? '#dfdfdf' : 'transparent';
$prefix = empty( $parents ) || in_array( $term_group['term_group'], $parents ) ? '' : '&nbsp;&nbsp;'; ?>
sel_filter.append(jQuery("<option>").attr("value", "<?php echo $term_group['term_group'] ?>").css('background-color', '<?php echo $bg_color ?>').html("<?php echo $prefix . htmlentities( $term_group['label'], ENT_QUOTES, "UTF-8" )?>"));
_e('Filter off', 'tag-groups'); ?>")
);

<?php foreach ($term_groups as $term_group):
$bg_color = in_array($term_group['term_group'], $parents) ? '#dfdfdf' : 'transparent';
$prefix = empty($parents) || in_array($term_group['term_group'], $parents) ? '' : '&nbsp;&nbsp;';
?>
sel_filter.append(jQuery("<option>").attr("value", "<?php echo $term_group['term_group']; ?>").css("background-color", "<?php echo $bg_color; ?>").html("<?php echo $prefix . htmlentities($term_group['label'], ENT_QUOTES, 'UTF-8'); ?>")
);
<?php endforeach; ?>
jQuery("#tag_filter option[value=<?php echo $tag_filter ?>]").prop('selected', true);

jQuery('#tg_reset_filter_button').hide();
var filterButton = jQuery("<button>").attr("id", "apply_filter_button").attr("class", "button button-primary").html("Filter").appendTo(container);

jQuery("#tag_filter option[value=<?php echo $tag_filter; ?>]").prop("selected", true);

jQuery("#tg_reset_filter_button").hide();
});
</script>
Loading