Like GitHub, show a shortcut path of the directory whoes ancestors have only one child directory.

This commit is contained in:
Shintaro Murakami
2014-09-10 07:07:04 +09:00
parent b8613431de
commit 79432ff8ad
3 changed files with 53 additions and 27 deletions

View File

@@ -84,9 +84,19 @@
<td>
@if(file.isDirectory){
@if(file.linkUrl.isDefined){
<a href="@file.linkUrl">@file.name</a>
<a href="@file.linkUrl">
<span class="simplified-path">@file.name.split("/").toList.init match {
case Nil => {}
case list => {@list.mkString("", "/", "/")}
}</span>@file.name.split("/").toList.last
</a>
} else {
<a href="@url(repository)/tree@{(encodeRefName(branch) :: pathList).mkString("/", "/", "/")}@file.name">@file.name</a>
<a href="@url(repository)/tree@{(encodeRefName(branch) :: pathList).mkString("/", "/", "/")}@file.name">
<span class="simplified-path">@file.name.split("/").toList.init match {
case Nil => {}
case list => {@list.mkString("", "/", "/")}
}</span>@file.name.split("/").toList.last
</a>
}
} else {
<a href="@url(repository)/blob@{(encodeRefName(branch) :: pathList).mkString("/", "/", "/")}@file.name">@file.name</a>