';
if (c.is_folder && hasKids) {
- html += '
';
+ html += '
';
} else {
html += '
';
}
@@ -389,9 +389,20 @@ document.addEventListener('alpine:init', function() {
return s.replace(/\\/g,'\\\\').replace(/'/g,"\\'").replace(/"/g,'"');
},
- toggleExpand(id) {
+ toggleExpand(id, btn) {
this.expanded[id] = !(this.expanded[id] || false);
this.expanded = Object.assign({}, this.expanded);
+ // For renderChildren static HTML: toggle the sibling
+ chevron rotation
+ if (btn) {
+ btn.classList.toggle('open', this.expanded[id]);
+ var li = btn.closest('li');
+ if (li) {
+ var ul = li.querySelector(':scope > ul.ws-tree');
+ if (ul) {
+ ul.style.display = this.expanded[id] ? '' : 'none';
+ }
+ }
+ }
},
navigateToFolder(id) {