diff --git a/src/main/scala/app/RepositoryViewerController.scala b/src/main/scala/app/RepositoryViewerController.scala index c94ac5a..6dbb2d4 100644 --- a/src/main/scala/app/RepositoryViewerController.scala +++ b/src/main/scala/app/RepositoryViewerController.scala @@ -137,12 +137,26 @@ }) /** + * 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. */ get("/:owner/:repository/tags")(referrersOnly { repo.html.tags(_) }) - + /** * Download repository contents as an archive. */ diff --git a/src/main/twirl/repo/branches.scala.html b/src/main/twirl/repo/branches.scala.html new file mode 100644 index 0000000..f88b6ee --- /dev/null +++ b/src/main/twirl/repo/branches.scala.html @@ -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) +

Branches

+ + + + + + + + @branchInfo.map { case (branchName, latestUpdateDate) => + + + + + + + } +
BranchLast updateCompareDownload
+ @branchName + @* + Delete branch + *@ + + @datetime(latestUpdateDate) + + @if(repository.repository.defaultBranch == branchName){ + Base branch + } else { + to @{repository.repository.defaultBranch} + } + ZIP
+} \ No newline at end of file diff --git a/src/main/twirl/repo/tab.scala.html b/src/main/twirl/repo/tab.scala.html index 0587e86..2f7ec74 100644 --- a/src/main/twirl/repo/tab.scala.html +++ b/src/main/twirl/repo/tab.scala.html @@ -26,9 +26,10 @@ } - Files - Commits - Tags@if(repository.tags.length > 0){ @repository.tags.length} + Files + Commits + Branches@if(repository.branchList.length > 0){ @repository.branchList.length} + Tags@if(repository.tags.length > 0){ @repository.tags.length}