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

Function renderChoiceList

deployments/desktop/static/app.js:563–584  ·  view source on GitHub ↗
(targetId, items, groupName)

Source from the content-addressed store, hash-verified

561}
562
563function renderChoiceList(targetId, items, groupName) {
564 const target = $(targetId);
565 if (!target) return;
566 if (!items.length) {
567 target.className = "choice-list empty";
568 target.textContent = "没有可用来源。";
569 return;
570 }
571 target.className = "choice-list";
572 target.innerHTML = items.map((item) => {
573 const disabled = item.enabled === false ? " disabled" : "";
574 const checked = item.enabled === false ? "" : " checked";
575 const group = item.group ? `<span>${escapeHtml(item.group)}</span>` : "";
576 return `
577 <label class="source-choice">
578 <input type="checkbox" name="${groupName}" value="${escapeHtml(item.id)}"${checked}${disabled}>
579 <span>${escapeHtml(item.label || item.id)}</span>
580 ${group}
581 </label>
582 `;
583 }).join("");
584}
585
586function selectedSourceValues(name) {
587 return [...document.querySelectorAll(`input[name="${name}"]:checked`)]

Callers 1

loadSourceOptionsFunction · 0.70

Calls 2

$Function · 0.70
escapeHtmlFunction · 0.70

Tested by

no test coverage detected