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/objecteditor.js | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'internal/admin/static/objecteditor.js') diff --git a/internal/admin/static/objecteditor.js b/internal/admin/static/objecteditor.js index 363cca9..15b656b 100644 --- a/internal/admin/static/objecteditor.js +++ b/internal/admin/static/objecteditor.js @@ -173,6 +173,9 @@ function renderObjectEditor(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(); setupObjectDropViews(); setTimeout(function() { @@ -204,24 +207,23 @@ function fieldIDSub(sec, subKey, idx, fieldKey) { } 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; if (sec.labelHint) { h += ' ' + esc(sec.labelHint) + ''; } h += ''; - h += ''; + h += ''; if (!sec.always) { - h += ''; + h += ''; } - h += '
'; - if (!collapsed) { - h += '
'; + h += ''; + h += '
'; if (sec.isArray) { h += renderArraySection(sec, data); @@ -325,9 +327,8 @@ function renderCard(sec, data) { h += ced_renderTagHelp('gather'); } } - h += '
'; - } h += '
'; + h += ''; return h; } @@ -731,11 +732,6 @@ function syncGatherToolsFromDOM() { } } -function toggleCard(id) { - expandedCards[id] = expandedCards[id] === false ? true : false; - renderCurrent(); -} - function toggleCardWidth(id) { cardWidths[id] = !cardWidths[id]; renderCurrent(); -- cgit v1.2.3