Move parent directory link inline with back to commits
Both tree.html and blob.html now show '< Parent directory' on the same line as '< Back to commits', separated by '|'. In blob view, parent directory navigates to the containing directory tree. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<p>
|
||||
<a th:href="@{/repo/{name}/commits(name=${name})}">< Back to commits</a>
|
||||
|
|
||||
<a th:href="@{/repo/{name}/tree/{hash}(name=${name}, hash=${hash})}">< Back to tree</a>
|
||||
<a th:href="@{/repo/{name}/tree/{hash}(name=${name}, hash=${hash}, path=${parentPath})}">< Parent directory</a>
|
||||
</p>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
|
||||
@@ -6,14 +6,15 @@
|
||||
<body>
|
||||
<h2>Browse <span th:text="${shortHash}"></span></h2>
|
||||
|
||||
<p><a th:href="@{/repo/{name}/commits(name=${name})}">< Back to commits</a></p>
|
||||
|
||||
<p th:if="${!path.isEmpty()}">
|
||||
Path: <b th:text="${path}"></b>
|
||||
<br>
|
||||
<a th:href="@{/repo/{name}/tree/{hash}(name=${name}, hash=${hash}, path=${path.contains('/') ? path.substring(0, path.lastIndexOf('/')) : ''})}">< Parent directory</a>
|
||||
<p>
|
||||
<a th:href="@{/repo/{name}/commits(name=${name})}">< Back to commits</a>
|
||||
<span th:if="${!path.isEmpty()}">
|
||||
| <a th:href="@{/repo/{name}/tree/{hash}(name=${name}, hash=${hash}, path=${parentPath})}">< Parent directory</a>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p th:if="${!path.isEmpty()}">Path: <b th:text="${path}"></b></p>
|
||||
|
||||
<table border="1" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
|
||||
Reference in New Issue
Block a user