{# Shared file-tree partial used by the content, plugin and theme editors. Renders a nested, collapsible file tree from a list of nodes produced by scanEditorFiles()/scanContentFiles()/scanPluginFiles()/scanThemeFiles(). Required variables (passed via include with ... context): - files: array of nodes [{name, path, is_dir, extension, size, modified, children}] - relFile: currently selected relative file path (for active highlight + auto-expand) - editableExts: array of editable extensions (shown as .EXT badge) - treeIdPrefix: prefix for collapse element ids (e.g. 'content-tree', 'plugin-tree', 'theme-tree') - treeRouteBase: admin route base used to build file links, e.g. '/admin/content' - treeRouteParams: extra query string for file links, e.g. 'plugin=MyPlugin&' or 'theme=default&' or '' (content) - treeMoveRoute: admin route for file move, e.g. '/admin/plugins-file-move' - treeMoveParams: extra query string for move link, e.g. 'plugin=X&' or '' - treeDirActions: boolean; show per-folder new-file/new-dir/rename buttons (default true) - treeFileMove: boolean; show per-file move/rename pencil button (default true) - treeHideActionsFor: array of relative paths where move/delete actions are hidden (e.g. ['theme.json']) - treeDirSelectRoute: if set, folder names are links to ?dir= (map-detail pane) - treeDirRenameRoute: if set, show a rename pencil per folder - treeDeleteBase: POST URL for file deletion (scope-specific) - treeScope: 'content' | 'theme' | 'plugin' (for tree-interactions.js) - treeMoveUrl: AJAX endpoint for drag-drop move (e.g. '/admin/tree-move') - treeScopeParam: extra query param string (e.g. 'plugin=MyPlugin&' or 'theme=default&' or '') Icon maps are chosen automatically from the node extension. #} {% macro tree(nodes, opts) %} {% import _self as macros %} {% endmacro %} {% import _self as tree_macros %} {# Render the tree inside the standard sidebar card. The container keeps the generic id "editorFileTree" so shared CSS/JS selectors work everywhere. #}
{{ treeHeader|default('Bestanden') }}
{% if treeDirSelectRoute is defined and treeDirSelectRoute is not empty %} {# Klikbare content-root: selecteert de root map (?dir= leeg). data-dir="" maakt de root ook een drag-drop doel (lege string = base dir). #} {{ treeRootLabel|default('content') }} {% endif %} {% if files is empty %}
{{ treeEmptyText|default('Geen bestanden gevonden.') }}
{% else %} {{ tree_macros.tree(files, { 'relFile': relFile, 'selectedDir': selectedDir|default(''), 'editableExts': editableExts, 'treeIdPrefix': treeIdPrefix, 'treeRouteBase': treeRouteBase, 'treeRouteParams': treeRouteParams, 'treeMoveRoute': treeMoveRoute, 'treeMoveParams': treeMoveParams, 'treeDirActions': treeDirActions is defined ? treeDirActions : true, 'treeDirSelectRoute': treeDirSelectRoute|default(''), 'treeDirRenameRoute': treeDirRenameRoute|default(''), 'treeFileMove': treeFileMove is defined ? treeFileMove : true, 'treeHideActionsFor': treeHideActionsFor|default([]), 'newFileModalId': newFileModalId|default('#newFileModal'), 'newDirModalId': newDirModalId|default(''), }) }} {% endif %}