Przeglądaj źródła

Added check/uncheck functionality for all checkboxes and added patch file

Co-authored-by: Shiv Tyagi <shivtyagi3015@gmail.com>
Sukritee Sharma 3 lat temu
rodzic
commit
fa7d1868ae
2 zmienionych plików z 16 dodań i 1 usunięć
  1. 12 1
      static/js/add_build.js
  2. 4 0
      templates/add_build.html

+ 12 - 1
static/js/add_build.js

@@ -167,7 +167,18 @@ const Features = (() => {
         fixAllDependencies();
     }
 
-    return {reset, handleDependenciesForFeature, disableDependents, updateDefaults, applyDefaults};
+    function checkUncheckAll(check) {
+        features.forEach(category => { 
+            category['options'].forEach(option => {
+                element = document.getElementById(option['label']);
+                if (element != undefined) {
+                    element.checked = check;
+                }
+            });
+        });
+    }
+
+    return {reset, handleDependenciesForFeature, disableDependents, updateDefaults, applyDefaults, checkUncheckAll};
 })();
 
 var init_categories_expanded = false;

+ 4 - 0
templates/add_build.html

@@ -97,6 +97,10 @@
                             <input class="form-check-input" type="checkbox" role="switch" id="auto_apply_def" checked>
                             <label class="form-check-label" for="auto_apply_def">Auto-apply feature defaults</label>
                         </div>
+                        <div class="form-check ms-3">
+                            <input class="form-check-input" type="checkbox" id="check-uncheck-all" onclick="Features.checkUncheckAll(this.checked);">
+                            <label class="form-check-label" for="check-uncheck-all">Check/Uncheck All</label>
+                        </div>
                     </div>
                     <div>
                         <button class="btn btn-outline-primary me-2" id="reset_def" onclick="Features.applyDefaults();"><i class="bi bi-arrow-counterclockwise me-2"></i>Reset feature defaults</button>