From 7c1a3938aee2ddecaa9d62f91ee14afba91b7b88 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 24 Mar 2020 16:00:41 +0000 Subject: [PATCH] Bug 24982: Use checkboxes in Log Viewer So we can see all options at once, and more easily select more than one option. Test plan: 1) Go to Tools -> Log viewer 2) Notice the new checkboxes under Modules, Actions and Interface. 'All' should be selected by default for all three options 3) Confirm you can deselect 'All' and the other options are enabled. Confirm selection all of the other options automatically selects 'All' and disables the options again. 4) Confirm the results still work as expected when clicking 'Submit' button Sponsored-by: Catalyst IT --- .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 78 +++++++++++----------- koha-tmpl/intranet-tmpl/prog/js/viewlog.js | 58 ++++++++++++++++ 2 files changed, 98 insertions(+), 38 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/viewlog.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt index 6e2632c6e3..4cb0068b05 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -15,6 +15,13 @@ [% END %] [% INCLUDE 'doc-head-close.inc' %] + @@ -101,41 +108,37 @@ [% UNLESS src == "circ" %]
  • - + [% ELSE %] + + [% END %] + [% FOREACH modx IN [ 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'ILL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS' ] %] + [% IF modules.grep(modx).size %] + [% ELSE %] - - [% END %] - [% FOREACH modx IN [ 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'ILL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS' ] %] - [% IF modules.grep(modx).size %] - - [% ELSE %] - - [% END %] + [% END %] - + [% END %]
  • [% ELSE %] [% END %]
  • - + [% ELSE %] + + [% END %] - [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'CHANGE PASS' 'Run' ] %] - [% IF actions.grep(actx).size %] - - [% ELSE %] - - [% END %] + [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'CHANGE PASS' 'Run' ] %] + [% IF actions.grep(actx).size %] + + [% ELSE %] + [% END %] - + [% END %]
  • [% IF src == 'circ' %] @@ -152,21 +155,19 @@
  • - + [% ELSE %] + + [% END %] - [% FOREACH interf IN [ 'INTRANET' 'OPAC' 'SIP' 'COMMANDLINE' ] %] - [% IF interfaces.grep(interf).size %] - - [% ELSE %] - - [% END %] + [% FOREACH interf IN [ 'INTRANET' 'OPAC' 'SIP' 'COMMANDLINE' ] %] + [% IF interfaces.grep(interf).size %] + + [% ELSE %] + [% END %] - + [% END %]
  • @@ -313,6 +314,7 @@ [% INCLUDE 'str/members-menu.inc' %] [% Asset.js("js/members-menu.js") | $raw %] [% END %] + [% Asset.js("js/viewlog.js") | $raw %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js new file mode 100644 index 0000000000..d41bb5d471 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js @@ -0,0 +1,58 @@ +function tickAll(section){ + $("input[name='" + section + "']").prop("checked", true); + $("#" + section.slice(0,-1) + "ALL").prop("checked", true); + $("input[name='" + section + "']").prop("disabled", true); + $("#" + section.slice(0,-1) + "ALL").prop("disabled", false); +} + +function untickAll(section){ + $("input[name='" + section + "']").prop("checked", false); + $("input[name='" + section + "']").prop("disabled", false); +} + +$(document).ready(function(){ + tickAll('modules'); + $("#moduleALL").change(function(){ + if ( this.checked == true ){ + tickAll('modules'); + } else { + untickAll('modules'); + } + + }); + $("input[name='modules']").change(function(){ + if ( $("input[name='modules']:checked").length == $("input[name='modules']").length - 1 ){ + tickAll('modules'); + } + }); + + tickAll('actions'); + $("#actionALL").change(function(){ + if ( this.checked == true ){ + tickAll('actions'); + } else { + untickAll('actions'); + } + + }); + $("input[name='actions']").change(function(){ + if ( $("input[name='actions']:checked").length == $("input[name='actions']").length - 1 ){ + tickAll('actions'); + } + }); + + tickAll('interfaces'); + $("#interfaceALL").change(function(){ + if ( this.checked == true ){ + tickAll('interfaces'); + } else { + untickAll('interfaces'); + } + + }); + $("input[name='interfaces']").change(function(){ + if ( $("input[name='interfaces']:checked").length == $("input[name='interfaces']").length - 1 ){ + tickAll('interfaces'); + } + }); +}); -- 2.11.0