MDL-57550 mod_forum: Set dates to initial checkbox state
authorAndrew Nicols <andrew@nicols.co.uk>
Wed, 25 Jan 2017 06:04:47 +0000 (14:04 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Wed, 25 Jan 2017 06:04:47 +0000 (14:04 +0800)
mod/forum/templates/big_search_form.mustache
theme/boost/templates/mod_forum/big_search_form.mustache

index 8a8a7f6..6fc760c 100644 (file)
             $('#searchform input[name^=h' + prefix + ']').val(disabled ? 1 : 0);
         };
 
-        toggleDateFields('from', true);
+        toggleDateFields('from', !$("#searchform input[name='timefromrestrict']").prop('checked'));
         $("#searchform input[name='timefromrestrict']").click(function() {
             toggleDateFields('from', !this.checked);
         });
 
-        toggleDateFields('to', true);
+        toggleDateFields('to', !$("#searchform input[name='timetorestrict']").prop('checked'));
         $("#searchform input[name='timetorestrict']").click(function() {
             toggleDateFields('to', !this.checked);
         });
index 32d30d4..c376145 100644 (file)
@@ -160,12 +160,12 @@ require(['jquery'], function($) {
         $('#searchform input[name^=h' + prefix + ']').val(disabled ? 1 : 0);
     };
 
-    toggleDateFields('from', true);
+    toggleDateFields('from', !$("#searchform input[name='timefromrestrict']").prop('checked'));
     $("#searchform input[name='timefromrestrict']").click(function() {
         toggleDateFields('from', !this.checked);
     });
 
-    toggleDateFields('to', true);
+    toggleDateFields('to', !$("#searchform input[name='timetorestrict']").prop('checked'));
     $("#searchform input[name='timetorestrict']").click(function() {
         toggleDateFields('to', !this.checked);
     });