This commit is contained in:
Mateusz Gruszczyński committed 2026-10-23 23:29:52 +02:00
1 parent ee54aa6875
commit 63cdecea6c
4 files changed
+22 -18

No files matched your search

+6 -3
View File
@@ -97,8 +97,9 @@
return lines.join("\n");
}
function update(view) {
const { target, options, summary, help, accountLabel, account, output, empty, copy } = view;
const { target, options, description, summary, help, accountLabel, account, output, empty, copy } = view;
target.hidden = options.enabled === false;
description.textContent = t(options.kind === "web" ? "pathPermissionsWebDescription" : "pathPermissionsCertificateDescription");
summary.textContent = t("pathPermissionsOptions");
help.textContent = t(options.kind === "web" ? "pathPermissionsWebHelp" : "pathPermissionsCertificateHelp");
accountLabel.textContent = t("pathPermissionsUser");
@@ -106,6 +107,7 @@
output.setAttribute("aria-label", t("pathPermissionsTitle"));
output.textContent = target.hidden ? "" : commands({ ...options, user: account.value });
output.hidden = !output.textContent;
description.hidden = output.hidden;
copy.disabled = !output.textContent;
empty.hidden = !!output.textContent;
empty.textContent = t(options.kind === "web" ? "pathPermissionsWebPrompt" : "pathPermissionsCertificatePrompt");
@@ -115,6 +117,7 @@
let view = views.get(target);
if (!view) {
target.classList.add("path-permissions");
const description = el("p", undefined, "fine path-permissions-description");
const actions = el("div", undefined, "form-actions path-permissions-actions");
const copy = el("button", undefined, "quiet");
copy.type = "button";
@@ -130,8 +133,8 @@
const empty = el("p", undefined, "fine");
details.append(summary, label, help);
actions.append(copy, details);
target.replaceChildren(output, empty, actions);
view = { target, options, summary, help, accountLabel, account, output, empty, copy };
target.replaceChildren(description, output, empty, actions);
view = { target, options, description, summary, help, accountLabel, account, output, empty, copy };
views.set(target, view);
account.addEventListener("input", () => update(view));
const selectOutput = () => {