Replace sidebar menu with collapsible category tree showing items

This commit is contained in:
2025-11-12 08:36:40 +01:00
parent 8f072292c1
commit 5549c67eb5
96 changed files with 95 additions and 10 deletions

View File

@@ -2,6 +2,22 @@ document.addEventListener('DOMContentLoaded', function() {
const mainContent = document.getElementById('main-content');
const appName = document.querySelector('.navbar-brand').textContent;
// Global function for editing item from tree
window.editItem = function(id) {
// Create a mock button to reuse handleEditItem
const mockBtn = { getAttribute: (attr) => attr === 'data-id' ? id : null };
handleEditItem.call(mockBtn);
};
// Function to toggle category children
window.toggleCategory = function(span) {
const li = span.parentElement;
const ul = li.querySelector('ul'); // First ul is children
if (ul) {
ul.style.display = ul.style.display === 'none' ? 'block' : 'none';
}
};
// --- Helper Functions ---
function setPageTitle(title) {
document.title = `${appName} - ${title}`;