From b5491f140ebf1099171c932b688303e05d01a06c Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 14 Jul 2026 04:26:34 -0400 Subject: feat(admin): hide unused mod fields --- internal/admin/static/cardeditor.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'internal/admin/static/cardeditor.js') diff --git a/internal/admin/static/cardeditor.js b/internal/admin/static/cardeditor.js index 83eed2e..b29b814 100644 --- a/internal/admin/static/cardeditor.js +++ b/internal/admin/static/cardeditor.js @@ -130,6 +130,41 @@ function ced_addKVSearchRow(cardID, subKey, entity) { ced_setupSearchFields(row); } +function ced_renderKVSelect(sec, il, data, getter) { + var sectionRoot = data[ced_cardPath(sec)] || data; + var map = getter ? getter(sectionRoot, il) : (sectionRoot[il.key] || {}); + var options = il.options || []; + var h = '
'; + h += '' + esc(il.label) + ''; + h += '
'; + Object.keys(map).forEach(function(k, idx) { + h += '
'; + h += ''; + h += ''; + h += '
'; + }); + h += '
'; + h += ''; + h += '
'; + return h; +} + +function ced_addKVSelectRow(cardID, subKey) { + var el = document.querySelector('.obj-kv-list[data-sec="' + cardID + '"][data-key="' + subKey + '"]'); + if (!el) return; + var opts = []; + try { opts = JSON.parse(el.getAttribute('data-options') || '[]'); } catch(e) {} + var optsHTML = opts.map(function(opt) { return ''; }).join(''); + var row = document.createElement('div'); + row.className = 'obj-kv-row'; + row.innerHTML = ''; + el.appendChild(row); +} + // ---- Search autocomplete ---- function ced_setupSearchFields(root) { -- cgit v1.2.3