From 110d44e23810a57e35a37f80ab48cfa2eb57b16a Mon Sep 17 00:00:00 2001 From: James Date: Sat, 14 Mar 2026 23:52:27 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20add=20=E2=8B=AF=20menu=20to=20request?= =?UTF-8?q?=5Flist=20and=20section=20rows=20=E2=80=94=20rename,=20delete,?= =?UTF-8?q?=20add=20section/request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- portal/templates/app/project.html | 58 ++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/portal/templates/app/project.html b/portal/templates/app/project.html index 0382136..e26f990 100644 --- a/portal/templates/app/project.html +++ b/portal/templates/app/project.html @@ -454,14 +454,24 @@ : `All`; html += ` - + ${chevron} ${escHtml(name)} ${visBadge} ${childCount} items - - + + + + + + `; } else if (item.type === 'section') { @@ -470,11 +480,19 @@ draggable="true" ondragstart="onDragStart(event)" ondragover="onDragOver(event)" ondragleave="onDragLeave(event)" ondrop="onDrop(event)"> \u2630 ${escHtml(num)} - + ${chevron} ${escHtml(name)} ${item.children_count||0} requests - + + + + + `; } else { @@ -616,6 +634,36 @@ } } + async function renameListOrSection(id, type) { + // Close the menu + const menu = document.getElementById('menu-' + id); + if (menu) menu.style.display = 'none'; + openMenuId = null; + + const item = treeData.find(t => t.entry_id === id); + if (!item) return; + const d = item.data || {}; + const currentName = d.name || d.title || ''; + const newName = prompt('Rename ' + (type === 'list' ? 'list' : 'section') + ':', currentName); + if (!newName || !newName.trim() || newName.trim() === currentName) return; + + const updated = { ...d, name: newName.trim(), title: newName.trim() }; + item.data = updated; + try { + const res = await fetchAPI('/api/projects/' + projectID + '/entries/' + id, { + method: 'PUT', + body: JSON.stringify({ data: JSON.stringify(updated), version: item.version || 0 }) + }); + if (res.ok) { + const result = await res.json(); + if (result.version) item.version = result.version; + renderTree(); + } + } catch(e) { + loadRequestTree(); + } + } + function toggleCollapse(id) { if (collapsed.has(id)) collapsed.delete(id); else collapsed.add(id); renderTree();