From b173ff729d1efc932456b48667f76e9de6633046 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 27 Dec 2023 16:01:05 +0000 Subject: [PATCH] Bug 33494: Make filters a toggle This patch updates the markup to make the 'Filter resolved | Show all' a toggle filter rather than two buttons. Test plan 1. Enable the CatalogConcerns system preference. 2. For two records, add a catalog concern (New > New catalog concern). 3. Resolve one of the concerns (Cataloging > Reports > Catalog concerns) - click on the 'Details' button then the 'Resolve' button. 4. Note that the filters at the top of the page are labelled: Hide resolved | Show all 5. Apply the patch and refresh the page. 6. Note that it is now a 'toggle': 'Include resolved' (default) or 'Filter resolved' Signed-off-by: Martin Renvoize Signed-off-by: David Nind Signed-off-by: Ray Delahunty Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer --- .../prog/en/modules/cataloguing/concerns.tt | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt index f16e5f2609..eeae5a31d6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt @@ -40,9 +40,8 @@

Concerns

-
- Hide resolved - | Show all +
+ Include resolved
@@ -82,10 +81,10 @@ var table_settings = [% TablesSettings.GetTableSettings('cataloguing', 'concerns', 'table_concerns', 'json') | $raw %]; - var filtered = false; + var filter_resolved = true; let additional_filters = { resolved_date: function(){ - if ( filtered ) { + if ( filter_resolved ) { return { "=": null }; } else { return; @@ -186,14 +185,18 @@ ] }, table_settings, 1, additional_filters); - $('#hideResolved').on("click", function() { - filtered = true; - tickets.DataTable().draw(); - }); - - $('#showAll').on("click", function() { - filtered = false; + var txtActivefilter = _("Filter resolved"); + var txtInactivefilter = _("Include resolved"); + $('#resolved_filter').on("click", function() { + if ($(this).hasClass('filtered')){ + filter_resolved = false; + $(this).html(' '+txtActivefilter); + } else { + filter_resolved = true; + $(this).html(' '+txtInactivefilter); + } tickets.DataTable().draw(); + $(this).toggleClass('filtered'); }); }); -- 2.39.5