Bug 24982: (follow-up) Retain checkbox selections after for submit
authorKyle M Hall <kyle@bywatersolutions.com>
Thu, 26 Mar 2020 15:14:59 +0000 (11:14 -0400)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 27 Mar 2020 11:52:32 +0000 (11:52 +0000)
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt
koha-tmpl/intranet-tmpl/prog/js/viewlog.js

index 1388368..5533f5a 100644 (file)
@@ -118,7 +118,7 @@ fieldset.rows label.viewlog {
                                 <li>
                                     <label for="modules">Modules:</label>
                                     <div class="log_modules">
-                                        [% UNLESS modules %]
+                                        [% IF modules.size == 0 %]
                                             <label for="moduleALL" class="viewlog"><input type="checkbox" id="moduleALL" name="modules" value="" checked="checked"> All</label>
                                         [% ELSE %]
                                             <label for="moduleALL" class="viewlog"><input type="checkbox" id="moduleALL" name="modules" value=""> All</label>
@@ -138,7 +138,7 @@ fieldset.rows label.viewlog {
                             <li>
                                 <label for="actions">Actions:</label>
                                 <div class="log_modules">
-                                    [% UNLESS actions %]
+                                    [% IF actions.length == 0 %]
                                         <label for="actionALL" class="viewlog"><input type="checkbox" id="actionALL" name="actions" value="" checked="checked"> All</label>
                                     [% ELSE %]
                                         <label for="actionALL" class="viewlog"><input type="checkbox" id="actionALL" name="actions" value=""> All</label>
@@ -168,7 +168,7 @@ fieldset.rows label.viewlog {
                                                        </li>
                             <li>
                                 <label for="interfaces">Interface:</label>
-                                [% UNLESS interfaces %]
+                                [% IF interfaces.size == 0 %]
                                     <label for="interfaceALL" class="viewlog"><input type="checkbox" id="interfaceALL" name="interfaces" value="" checked="checked"> All</label>
                                 [% ELSE %]
                                     <label for="interfaceALL" class="viewlog"><input type="checkbox" id="interfaceALL" name="interfaces" value=""> All</label>
@@ -176,9 +176,9 @@ fieldset.rows label.viewlog {
 
                                 [% FOREACH interf IN [ 'INTRANET' 'OPAC' 'SIP' 'COMMANDLINE' ] %]
                                     [% IF interfaces.grep(interf).size %]
-                                        <label for="interface[% interf | html %]" class="viewlog"><input type="checkbox" id="interface[% interf | html %]" name="interfaces" value="" checked="checked"> [% PROCESS translate_log_interface log_interface=interf %]</label>
+                                        <label for="interface[% interf | html %]" class="viewlog"><input type="checkbox" id="interface[% interf | html %]" name="interfaces" value="[% interf | html %]" checked="checked"> [% PROCESS translate_log_interface log_interface=interf %]</label>
                                     [% ELSE %]
-                                        <label for="interface[% interf | html %]" class="viewlog"><input type="checkbox" id="interface[% interf | html %]" name="interfaces" value=""> [% PROCESS translate_log_interface log_interface=interf %]</label>
+                                        <label for="interface[% interf | html %]" class="viewlog"><input type="checkbox" id="interface[% interf | html %]" name="interfaces" value="[% interf | html %]"> [% PROCESS translate_log_interface log_interface=interf %]</label>
                                     [% END %]
                                 [% END %]
                             </li>
index d41bb5d..ccec003 100644 (file)
@@ -11,14 +11,16 @@ function untickAll(section){
 }
 
 $(document).ready(function(){
-    tickAll('modules');
+
+    if ( $('input[name="modules"]:checked').length == 0 ) {
+        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 ){
@@ -26,7 +28,9 @@ $(document).ready(function(){
         }
     });
 
-    tickAll('actions');
+    if ( $('input[name="actions"]:checked').length == 0 ) {
+        tickAll('actions');
+    }
     $("#actionALL").change(function(){
         if ( this.checked == true ){
             tickAll('actions');
@@ -41,7 +45,9 @@ $(document).ready(function(){
         }
     });
 
-    tickAll('interfaces');
+    if ( $('input[name="interfaces"]:checked').length == 0 ) {
+        tickAll('interfaces');
+    }
     $("#interfaceALL").change(function(){
         if ( this.checked == true ){
             tickAll('interfaces');