mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
(refs #23)Add "Branch" tab to the repository viewer.
This commit is contained in:
@@ -136,6 +136,20 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays branches.
|
||||||
|
*/
|
||||||
|
get("/:owner/:repository/branches")(referrersOnly { repository =>
|
||||||
|
JGitUtil.withGit(getRepositoryDir(repository.owner, repository.name)){ git =>
|
||||||
|
// retrieve latest update date of each branch
|
||||||
|
val branchInfo = repository.branchList.map { branchName =>
|
||||||
|
val revCommit = git.log.add(git.getRepository.resolve(branchName)).setMaxCount(1).call.iterator.next
|
||||||
|
(branchName, revCommit.getCommitterIdent.getWhen)
|
||||||
|
}
|
||||||
|
repo.html.branches(branchInfo, repository)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays tags.
|
* Displays tags.
|
||||||
*/
|
*/
|
||||||
|
|||||||
38
src/main/twirl/repo/branches.scala.html
Normal file
38
src/main/twirl/repo/branches.scala.html
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
@(branchInfo: List[(String, java.util.Date)],
|
||||||
|
repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
|
||||||
|
@import context._
|
||||||
|
@import view.helpers._
|
||||||
|
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
||||||
|
@html.header("code", repository)
|
||||||
|
@tab(repository.repository.defaultBranch, repository, "branches", true)
|
||||||
|
<h1>Branches</h1>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<tr>
|
||||||
|
<th width="40%">Branch</th>
|
||||||
|
<th width="20%">Last update</th>
|
||||||
|
<th width="20%">Compare</th>
|
||||||
|
<th width="20%">Download</th>
|
||||||
|
</tr>
|
||||||
|
@branchInfo.map { case (branchName, latestUpdateDate) =>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="@url(repository)/tree/@branchName">@branchName</a>
|
||||||
|
@*
|
||||||
|
<a href="#" class="btn btn-danger btn-mini">Delete branch</a>
|
||||||
|
*@
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@datetime(latestUpdateDate)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@if(repository.repository.defaultBranch == branchName){
|
||||||
|
Base branch
|
||||||
|
} else {
|
||||||
|
<a href="@url(repository)/compare/@{repository.repository.defaultBranch}...@branchName">to @{repository.repository.defaultBranch}</a>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td><a href="@url(repository)/archive/@{branchName}.zip">ZIP</a></td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</table>
|
||||||
|
}
|
||||||
@@ -27,7 +27,8 @@
|
|||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
<li@if(active=="files" ){ class="active"}><a href="@url(repository)/tree/@id">Files</a></li>
|
<li@if(active=="files" ){ class="active"}><a href="@url(repository)/tree/@id">Files</a></li>
|
||||||
<li@if(active=="commits"){ class="active"}><a href="@url(repository)/commits/@id">Commits</a></li>
|
<li@if(active=="commits" ){ class="active"}><a href="@url(repository)/commits/@id">Commits</a></li>
|
||||||
|
<li@if(active=="branches"){ class="active"}><a href="@url(repository)/branches">Branches@if(repository.branchList.length > 0){ <span class="badge">@repository.branchList.length</span>}</a></li>
|
||||||
<li@if(active=="tags" ){ class="active"}><a href="@url(repository)/tags">Tags@if(repository.tags.length > 0){ <span class="badge">@repository.tags.length</span>}</a></li>
|
<li@if(active=="tags" ){ class="active"}><a href="@url(repository)/tags">Tags@if(repository.tags.length > 0){ <span class="badge">@repository.tags.length</span>}</a></li>
|
||||||
<li class="pull-right">
|
<li class="pull-right">
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
|
|||||||
Reference in New Issue
Block a user