diff options
| author | historia <[not public]> | 2026-07-04 22:44:42 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-04 22:44:42 -0400 |
| commit | ad22ea3526a146ea8ce305c8375c35836465cc30 (patch) | |
| tree | 479cec511e596bb09d3f3792dcf10a2201e9b7f8 /internal/admin/static/editor.js | |
| parent | 7b009e904524f30cbff6346730e8d8fe4b046a6b (diff) | |
| download | thehouseoficarus-ad22ea3526a146ea8ce305c8375c35836465cc30.tar.gz | |
feat: admin gui move objects between directories and better toolbar wrapping
Diffstat (limited to 'internal/admin/static/editor.js')
| -rw-r--r-- | internal/admin/static/editor.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/admin/static/editor.js b/internal/admin/static/editor.js index 37bc797..35bdbe6 100644 --- a/internal/admin/static/editor.js +++ b/internal/admin/static/editor.js @@ -233,3 +233,32 @@ function esc(s) { return String(s || '').replace(/&/g,'&').replace(/</g,'< function escAttr(s) { return String(s || '').replace(/&/g,'&').replace(/"/g,'"'); } window.refreshPage = function() { loadList(); if (currentID) loadItem(currentID); }; + +function renderMoveBar() { + var dirs = Object.keys(treeData.dirs).sort(); + var html = '<div class="add-section-bar">'; + html += '<select id="moveDirSelect">'; + html += '<option value="">Move to directory...</option>'; + html += '<option value="">Root</option>'; + dirs.forEach(function(dir) { + html += '<option value="' + escAttr(dir) + '">' + esc(dir) + '</option>'; + }); + html += '</select>'; + html += '<button class="btn btn-primary btn-sm" onclick="moveToDirectory()">Move</button>'; + html += '</div>'; + return html; +} + +function moveToDirectory() { + var sel = $('#moveDirSelect'); + var idx = sel.selectedIndex; + if (idx === 0) return; + var dir = sel.value; + if (!confirm('Move ' + currentID + ' to ' + (dir || 'Root') + '?')) return; + API.post('/api/' + editorType + '/move', {id: currentID, dir: dir}).then(function() { + notify('Moved ' + currentID + ' to ' + (dir || 'Root'), 'success'); + updateUndoBar(); + loadList(); + loadItem(currentID); + }).catch(function(e) { notify('Move failed: ' + e.message, 'error'); }); +} |
