From 7241e519956213bff7851d21a4788bf0ef5b0a61 Mon Sep 17 00:00:00 2001 From: Jasmine Amohia Date: Thu, 21 Jan 2021 12:00:38 +0000 Subject: [PATCH] Bug 22150: Ability to select or unselect all member flags To test: 1) Find a patron 2) Click More -> Set permissions 3) Click 'Clear all', confirm all checkboxes get cleared and disabled 4) Click 'Select all', confirm all checkboxes get selected 5) Unselect one checkbox (not superlibrarian), and confirm that the superlibrarian checkbox also gets unselected 6) Confirm that saving still works as expected Edit: Rebased by Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- .../prog/en/modules/members/member-flags.tt | 42 +++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt index d9eef9a824..6325e69317 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt @@ -21,7 +21,7 @@ [% INCLUDE 'members-toolbar.inc' %] -
+ @@ -33,6 +33,12 @@ Cancel Show all Hide all + + Select all + + + Clear all +
Filter: @@ -105,6 +111,22 @@ var Sticky; $(document).ready(function() { + $("#CheckAllFlags").on("click",function(){ + $(".flag").attr("disabled", false); + $(".flag").prop("checked", true); + return false; + }); + $("#UncheckAllFlags").on("click",function(){ + $(".flag").attr("disabled", false); + $(".flag").prop("checked", false); + return false; + }); + $(".flag").change(function(){ + if(!$(this).is(':checked')){ + $("input#flag-0").prop("checked", false); + } + }); + Sticky = $("#permissions_toolbar"); Sticky.hcSticky({ stickTo: "#permissionstree", @@ -144,12 +166,7 @@ alert(_("Inconsistency detected!") + "\n\n" + _("The superlibrarian privilege is mutually exclusive of other privileges, as it includes them all.") + "\n\n" + _("This patron's privileges will now be reset to include only superlibrarian.")); } - $('input[name="flag"]').each(function() { - if($(this).attr('id') != "flag-0" && !$(this).hasClass('superlib') ){ - $(this).prop('disabled', true); - $(this).prop('checked', false); - } - }); + setLibrarian(); } $('input#flag-0').click(function() { @@ -222,8 +239,17 @@ } } }); - }); + + function setLibrarian(){ + $('input[name="flag"]').each(function() { + if($(this).attr('id') != "flag-0" && !$(this).hasClass('superlib') ){ + $(this).prop('disabled', true); + $(this).prop('checked', false); + } + }); + } + [% END %] -- 2.39.5