diff --git a/src/main/java/be/seeseepuff/webgit/controller/RepoController.java b/src/main/java/be/seeseepuff/webgit/controller/RepoController.java index 2609751..6503e9b 100644 --- a/src/main/java/be/seeseepuff/webgit/controller/RepoController.java +++ b/src/main/java/be/seeseepuff/webgit/controller/RepoController.java @@ -114,6 +114,7 @@ public class RepoController model.addAttribute("hash", hash); model.addAttribute("shortHash", hash.substring(0, Math.min(7, hash.length()))); model.addAttribute("path", path); + model.addAttribute("parentPath", path.contains("/") ? path.substring(0, path.lastIndexOf('/')) : ""); model.addAttribute("files", gitService.listFilesAtCommit(name, hash, path)); return "tree"; } @@ -127,9 +128,11 @@ public class RepoController String filePath = fullPath.substring(prefix.length()); String ext = filePath.contains(".") ? filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase() : ""; boolean isImage = IMAGE_EXTENSIONS.contains(ext); + String parentPath = filePath.contains("/") ? filePath.substring(0, filePath.lastIndexOf('/')) : ""; model.addAttribute("name", name); model.addAttribute("hash", hash); model.addAttribute("filePath", filePath); + model.addAttribute("parentPath", parentPath); model.addAttribute("isImage", isImage); if (!isImage) model.addAttribute("content", gitService.getFileContentAtCommit(name, hash, filePath)); diff --git a/src/main/resources/templates/blob.html b/src/main/resources/templates/blob.html index f7578f6..f51b523 100644 --- a/src/main/resources/templates/blob.html +++ b/src/main/resources/templates/blob.html @@ -9,7 +9,7 @@

< Back to commits | -< Back to tree +< Parent directory

diff --git a/src/main/resources/templates/tree.html b/src/main/resources/templates/tree.html index 47cdf2c..b140913 100644 --- a/src/main/resources/templates/tree.html +++ b/src/main/resources/templates/tree.html @@ -6,14 +6,15 @@

Browse

-

< Back to commits

- -

-Path: -
-< Parent directory +

+< Back to commits + +| < Parent directory +

+

Path:

+
Type