From b5c3c413860a9c2af470ea8011820eb72a2c4703 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Sun, 12 Sep 2021 09:21:12 +0200 Subject: [PATCH] fix: open current folder in file tree --- public/script/app.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/script/app.js b/public/script/app.js index 9ffa382..7f2853a 100644 --- a/public/script/app.js +++ b/public/script/app.js @@ -193,6 +193,13 @@ angular $scope.repoId = document.location.pathname.split("/")[2]; $scope.opens = {}; + + let accumulatedPath = ""; + $routeParams.path.split("/").forEach((f) => { + $scope.opens[accumulatedPath + "/" + f] = true; + accumulatedPath = accumulatedPath + "/" + f; + }); + const toArray = function (obj) { const output = []; for (let name in obj) { @@ -258,6 +265,9 @@ angular } else { output += `${name}`; } + if ($scope.opens[path]) { + output += generate(f.child, parentPath + "/" + f.name); + } // output += generate(f.child, parentPath + "/" + f.name); output + ""; }