MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / syncChoiceListFromSettings

Function syncChoiceListFromSettings

deployments/desktop/static/desktop.js:2126–2142  ·  view source on GitHub ↗
(id, values, enabled = true, options = {})

Source from the content-addressed store, hash-verified

2124 }
2125
2126 function syncChoiceListFromSettings(id, values, enabled = true, options = {}) {
2127 const target = $(id);
2128 if (!target) return;
2129 const configured = new Set(splitListValue(values));
2130 const inputs = Array.from(target.querySelectorAll("input[type='checkbox']"));
2131 const defaultChecked = options.defaultChecked || "none";
2132 const useConfigured = options.useConfigured !== false;
2133 inputs.forEach((input, index) => {
2134 if (useConfigured && configured.size) {
2135 input.checked = configured.has(input.value);
2136 } else {
2137 input.checked = defaultCheckedForSource(index, defaultChecked);
2138 }
2139 input.disabled = !enabled;
2140 input.closest("label")?.classList.toggle("disabled", !enabled);
2141 });
2142 }
2143
2144 function syncDailySourceControls(sourcePrefs = {}) {
2145 syncChoiceListFromSettings(

Callers 1

syncDailySourceControlsFunction · 0.85

Calls 3

splitListValueFunction · 0.85
defaultCheckedForSourceFunction · 0.85
$Function · 0.70

Tested by

no test coverage detected