Skip to content

Commit

Permalink
Merge pull request #519 from euphorie/fix-sidebar-order
Browse files Browse the repository at this point in the history
getTreeData: Don't change the order of the siblings
  • Loading branch information
cillianderoiste committed Mar 22, 2023
2 parents ef3621b + 385651b commit 75ad7a3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/euphorie/client/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ def morph(obj):
# Include the siblings and the first level of the sibling trees so
# that they are still visible and browsable from the sidebar
for sibling in parent.siblings(model.Module, filter=filter):
if sibling.id != new["id"]:
if sibling.id == new["id"]:
new["children"] = result["children"]
siblings.append(new)
else:
info = morph(sibling)
info["type"] = "location"
children = []
Expand All @@ -279,8 +282,10 @@ def morph(obj):
children.append(child_info)
info["children"] = children
siblings.append(info)
new["children"] = result["children"]
result["children"] = [new] + siblings
if not siblings:
new["children"] = result["children"]
siblings.append(new)
result["children"] = siblings

# Finally list all modules at the root level
parent = parents.pop()
Expand Down

0 comments on commit 75ad7a3

Please sign in to comment.