From 223d198c95b64d3d803be5d914c5b899dd30c8eb Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 13 Jul 2026 19:59:34 -0400 Subject: refactor(admin): simplify css and js of card collapsing and side bar directories --- internal/admin/static/techeditor.js | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'internal/admin/static/techeditor.js') diff --git a/internal/admin/static/techeditor.js b/internal/admin/static/techeditor.js index 812cded..020ba11 100644 --- a/internal/admin/static/techeditor.js +++ b/internal/admin/static/techeditor.js @@ -95,6 +95,9 @@ function renderTechEditor(id, data) { html += ''; $('#editorMain').innerHTML = html; + document.querySelectorAll('details.obj-card').forEach(function(d) { + d.addEventListener('toggle', function() { expandedCards[d.getAttribute('data-card')] = d.open; }); + }); setupSearchFields(); } @@ -105,25 +108,23 @@ function renderCurrent() { } function renderCard(sec, data) { - var collapsed = expandedCards[sec.id] === false; + var openAttr = expandedCards[sec.id] === false ? '' : ' open'; var isFull = cardWidths[sec.id] !== undefined ? cardWidths[sec.id] : (sec.fullWidth || false); var fullClass = isFull ? ' obj-card-full' : ''; - var h = '
'; - h += '
'; - h += '' + (collapsed ? '▶' : '▼') + ''; + var h = '
'; + h += ''; + h += ''; h += '' + sec.label + ''; - h += ''; + h += ''; + h += ''; + h += '
'; + h += '
'; + sec.fields.forEach(function(f) { + h += renderField(sec, f, data, -1); + }); h += '
'; - if (!collapsed) { - h += '
'; - h += '
'; - sec.fields.forEach(function(f) { - h += renderField(sec, f, data, -1); - }); - h += '
'; - h += '
'; - } h += '
'; + h += '
'; return h; } @@ -131,11 +132,6 @@ function renderField(sec, f, data, idx) { return ced_renderField(sec, f, data, idx, null, null, cardPath, fieldID, getVal); } -function toggleCard(id) { - expandedCards[id] = expandedCards[id] === false ? true : false; - renderCurrent(); -} - function toggleCardWidth(id) { cardWidths[id] = !cardWidths[id]; renderCurrent(); -- cgit v1.2.3