feat(cms): reuse shared setting rows for boolean content controls
DC CMS qualification / qualify (push) Successful in 1m49s

This commit is contained in:
DCCONSTRUCTIONS
2026-11-05 21:32:59 +03:00
parent 7f25f59d3e
commit be8ebe43e7
5 changed files with 36 additions and 16 deletions
+14 -14
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -278,6 +278,7 @@
</form>
</dialog>
<template id="ds-settingRow"><section class="nodedc-settings-card" data-align="center"><header class="nodedc-settings-card__head"><div class="nodedc-settings-card__titles"><h2>Настройка</h2></div><div class="nodedc-settings-card__actions"><span data-slot="control"></span></div></header></section></template>
<template id="ds-nestedSurface"><div class="nodedc-glass" data-tone="group" data-radius="card" data-padding="md"><span></span></div></template>
<template id="ds-dragHandle"><button type="button" class="nodedc-drag-handle" aria-label="Перетащить блок"><svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><circle cx="4" cy="4" r="0.75"></circle><circle cx="8" cy="4" r="0.75"></circle><circle cx="12" cy="4" r="0.75"></circle><circle cx="4" cy="8" r="0.75"></circle><circle cx="8" cy="8" r="0.75"></circle><circle cx="12" cy="8" r="0.75"></circle></svg></button></template>
<template id="ds-button"><button type="button" class="nodedc-button" data-variant="secondary"><span class="nodedc-button__content">Действие</span></button></template>
+10
View File
@@ -115,3 +115,13 @@ tokens. No business module, site data, deployment settings or server API changed
Validation: deterministic generated build, multisite and release-contract tests;
local browser checks of the reported navigation-link fields, dark/light, settings
through the profile menu, custom accent, reset, and Escape focus restoration.
## Full-width boolean setting rows
A boolean editable field can declare `layout: "row"` and an optional `title`.
The editor uses the shared SettingsCard (centered header-only layout) and Switch,
above the following field in schema order. Values continue through the standard
model save/render/publish flow; no carousel-specific CMS state or new CSS is
introduced. Mission Core uses this for its per-carousel image-opening setting.
Local UI acceptance: toggle on → Save → reload retains true, toggle off → Save
removes the image links while preserving the other carousels.
+1 -1
View File
@@ -36,7 +36,7 @@ const actions = h("div", { className: "cms-editor-actions" }, h(StatusBadge, { i
const content = h(ApplicationPanel, { eyebrow: h("span", { id: "editor-heading" }, "\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0441\u0430\u0439\u0442\u0430"), title: "\u041A\u043E\u043D\u0442\u0435\u043D\u0442", description: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043B", headerTools: actions, expanded: true, onClose: noop }, h("div", { className: "cms-editor", dangerouslySetInnerHTML: { __html: await read("editor.html") } }));
const shell = html(h(ApplicationShell, { id: "cms-shell", header, stage: h("div", { className: "cms-stage" }, h("p", null, "\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u0430\u0439\u0442\u0430\u043C\u0438 NODE.DC"), btn("open-navigation", "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0440\u0430\u0437\u0434\u0435\u043B\u044B")), navigation: nav, content, navigationOpen: true, contentOpen: true, contentExpanded: true }));
const icons = ["close", "plus", "chevron-up", "chevron-down", "copy", "clipboard", "trash", "eye", "eye-off", "layers", "panel", "file", "settings", "folder", "image", "video", "refresh", "move", "edit"];
const templates = Object.entries({ nestedSurface: h(GlassSurface, {tone:"group", padding:"md", materialRim:false}, h("span")), dragHandle: h(DragHandle, {label:"Перетащить блок"}), button: h(Button, null, "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435"), iconButton: h(IconButton, { label: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435" }, icon("plus")), field: h(FieldFrame, { label: "\u041F\u043E\u043B\u0435" }, h("span", { "data-slot": "control" })), text: h(TextField, { id: "template-field", label: "\u041F\u043E\u043B\u0435" }), card: h(SettingsCard, { eyebrow: "\u0420\u0430\u0437\u0434\u0435\u043B", title: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435", description: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435" }, h("div", { "data-slot": "body" })), media: h(MediaSourceField, { label: "\u041C\u0435\u0434\u0438\u0430", source: "file", url: "", onSourceChange: noop, onUrlChange: noop, onFileChange: noop }), ...Object.fromEntries(icons.map((name) => ["icon-" + name, icon(name)])) }).map(([name, node]) => `<template id="ds-${name}">${html(node)}</template>`).join("\n");
const templates = Object.entries({ settingRow: h(SettingsCard, { title: "Настройка", align: "center", actions: h("span", { "data-slot": "control" }) }), nestedSurface: h(GlassSurface, {tone:"group", padding:"md", materialRim:false}, h("span")), dragHandle: h(DragHandle, {label:"Перетащить блок"}), button: h(Button, null, "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435"), iconButton: h(IconButton, { label: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435" }, icon("plus")), field: h(FieldFrame, { label: "\u041F\u043E\u043B\u0435" }, h("span", { "data-slot": "control" })), text: h(TextField, { id: "template-field", label: "\u041F\u043E\u043B\u0435" }), card: h(SettingsCard, { eyebrow: "\u0420\u0430\u0437\u0434\u0435\u043B", title: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435", description: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435" }, h("div", { "data-slot": "body" })), media: h(MediaSourceField, { label: "\u041C\u0435\u0434\u0438\u0430", source: "file", url: "", onSourceChange: noop, onUrlChange: noop, onFileChange: noop }), ...Object.fromEntries(icons.map((name) => ["icon-" + name, icon(name)])) }).map(([name, node]) => `<template id="ds-${name}">${html(node)}</template>`).join("\n");
const page = `<!doctype html>
<html lang="ru" data-nodedc-ui="true" data-nodedc-theme="dark" data-nodedc-appearance="mission" data-nodedc-edges="flat"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="design-system-commit" content="${lock.sourceCommit}"><title>NODE.DC \u2014 CMS</title><link rel="stylesheet" href="./admin.css"></head><body>${shell}
${await read("modals.html")}
+10 -1
View File
@@ -474,6 +474,7 @@ const STATIC_FALLBACK = {
};
const GROUP_COPY = {
"Карусель": "Общие параметры просмотра и порядок слайдов.",
"Шапка: логотип": "Статичный знак верхней mac-панели: файл логотипа, alt и брендовая подпись.",
"Шапка: ссылки": "Пункты навигации верхней mac-панели. Каждый пункт можно добавить, удалить и переставить.",
Уведомления: "Карточки уведомлений справа сверху. Порядок в админке соответствует порядку на сайте.",
@@ -4387,7 +4388,15 @@ function renderBooleanField({ block, editableField, grid }) {
});
label.append(labelRow, input, path);
grid.append(label);
if (editableField.layout === "row") {
const row = document.querySelector("#ds-settingRow").content.firstElementChild.cloneNode(true);
row.classList.add("wide");
row.querySelector("h2").textContent = editableField.title || editableField.label || editableField.path;
row.querySelector('[data-slot="control"]').replaceWith(label);
grid.append(row);
} else {
grid.append(label);
}
}
function formatRangeValue(value, editableField) {