[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Correct logic for "Select all" and "Select working days" checkboxes in calendar view

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68924bd47bff5_2cd5d0423639@gitlab-sidekiq-low-urgency-cpu-bound-v2-6b9b65f69d-x9f75.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
03b79094 by Landry Bitege at 2025-08-05T18:14:27+00:00
[FIX] Correct logic for "Select all" and "Select working days" checkboxes in calendar view
---
* [FIX] Correct logic for "Select all" and "Select working days" checkboxes in calendar view

See merge request tikiwiki/tiki!8098

- - - - -


1 changed file:

- lib/jquery_tiki/tiki-jquery.js


Changes:

=====================================
lib/jquery_tiki/tiki-jquery.js
=====================================
@@ -2982,14 +2982,35 @@ $.curCSS = function (element, property) {
 };
 
 // Select all days or select working days for calendar
-  $(document).ready(function() {
-    $('#select-all-days').on('change', function() {
-      $('input[name="viewdays[]"]').prop('checked', this.checked);
+$(document).ready(function () {
+    const allDays = $("#select-all-days");
+    const workingDays = $("#select-working-days");
+    const viewdays = $('input[name="viewdays[]"]');
+
+    allDays.on("change", function () {
+        if (this.checked) {
+            viewdays.prop("checked", true);
+            workingDays.prop("checked", false);
+        } else {
+            viewdays.prop("checked", false);
+        }
     });
-    $('#select-working-days').on('change', function() {
-      $('input[name="viewdays[]"]').slice(1, -1).prop('checked', this.checked);
+
+    workingDays.on("change", function () {
+        if (this.checked) {
+            viewdays.each(function (index) {
+                $(this).prop("checked", index >= 1 && index <= 5);
+            });
+            allDays.prop("checked", false);
+        } else {
+            viewdays.each(function (index) {
+                if (index >= 1 && index <= 5) {
+                    $(this).prop("checked", false);
+                }
+            });
+        }
     });
-  });
+});
 
 $.fn.registerFacet = function () {
     this.each(function () {



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/03b79094b1c8b887fd2034857ee60488ad68bdc9

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/03b79094b1c8b887fd2034857ee60488ad68bdc9
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.