Skip to content

Commit

Permalink
code: Fix file tab link bug
Browse files Browse the repository at this point in the history
For files of root path, 'file' tab menu link isn't properly set.
This commit fix that problem.

See: Yona Github issue #189
  • Loading branch information
doortts committed Mar 25, 2017
1 parent 3379a7f commit 1b873ae
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/views/code/view.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,22 @@
}
}

@pathWithoutFileName(path:String) = @{
if(path.lastIndexOf("/") > 0){
path.substring(0, path.lastIndexOf("/"))
} else {
""
}
}

@projectLayout(Messages("menu.code"), project, utils.MenuType.CODE){
@projectMenu(project, utils.MenuType.CODE, "main-menu-only")
<div class="page-wrap-outer">
<div class="project-page-wrap">
<div class="code-browse-wrap">
@if(fieldText(recursiveData{0}, "type").eq("folder")){
<ul class="nav nav-tabs">
@if(path.lastIndexOf("/") > 0){
<li class="active"><a href="@routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, URLEncoder.encode(branch, "UTF-8"), path.substring(0, path.lastIndexOf("/")))">@Messages("code.files")</a></li>
} else {
<li class="active"><a href="@routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, URLEncoder.encode(branch, "UTF-8"), path)">@Messages("code.files")</a></li>
}
<li class="active"><a href="@routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, URLEncoder.encode(branch, "UTF-8"), pathWithoutFileName(path))">@Messages("code.files")</a></li>
@if(branch.eq("HEAD")){
<li><a href="@routes.CodeHistoryApp.historyUntilHead(project.owner, project.name)">@Messages("code.commits")</a></li>
} else {
Expand Down

0 comments on commit 1b873ae

Please sign in to comment.