Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZMI-Sitetree shall expand with current content node #191

Closed
wants to merge 3 commits into from

Conversation

drfho
Copy link
Contributor

@drfho drfho commented Oct 4, 2023

Sitetree opens always with client root node, not the current content node (context).
As a 1st step I added a data-path-attribute to the ul-elements:
$ZMI.objectTree.init() needs to iterate/click async/await through the path fragements

function zmi_objecttree_expand() {
	pathbase = window.location.pathname.split('/content/')[0]
	pathfragments = window.location.pathname.split(pathbase+'/')[1].split('/')
	pathfragments.pop(0);
	pth = pathbase;
	var i = 0;
	(function click_head(i) {
		setTimeout(function(){
			pth += `/${pathfragments[i]}`;
			console.log(pth);
			$(`ul[data-path="${pth}"] > li:first`).addClass('active');
			$(`ul[data-path="${pth}"] > li:first > i`).click();
			if (i < pathfragments.length - 1 ) {
				click_head(i+1);
			}
		}, 1000);
	})(i)
};

tree_expand

Ref: https://github.com/idasm-unibe-ch/unibe-cms/issues/416

@drfho drfho requested a review from zmsdev October 4, 2023 20:28
@drfho
Copy link
Contributor Author

drfho commented Oct 5, 2023

fixed by #192

@drfho drfho closed this Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant