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/dropeditor.js | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'internal/admin/static/dropeditor.js') diff --git a/internal/admin/static/dropeditor.js b/internal/admin/static/dropeditor.js index e8ade87..029b983 100644 --- a/internal/admin/static/dropeditor.js +++ b/internal/admin/static/dropeditor.js @@ -77,6 +77,9 @@ function renderDropEditor(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(); setupDropEditorDropView(); } @@ -88,21 +91,19 @@ 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 += '
'; - if (!collapsed) { - h += '
'; - h += renderArraySection(sec, data); - h += '
'; - } + h += ''; + h += ''; + h += '
'; + h += renderArraySection(sec, data); h += '
'; + h += ''; return h; } @@ -159,11 +160,6 @@ function addDropRow(cardID, kind) { renderCurrent(); } -function toggleCard(id) { - expandedCards[id] = expandedCards[id] === false ? true : false; - renderCurrent(); -} - function toggleCardWidth(id) { cardWidths[id] = !cardWidths[id]; renderCurrent(); -- cgit v1.2.3