@** * Yona, 21st Century Project Hosting SW * * Copyright Yona & Yobi Authors & NAVER Corp. * https://yona.io **@ @(project: Project, history: List[playRepository.Commit], page: Integer, selectedBranch: String, path:String) @import utils.JodaDateUtil._ @import utils.TemplateHelper._ @import utils.TemplateHelper.Branches._ @import utils.Url @import playRepository.RepositoryService @import java.net.URLEncoder @import org.joda.time.Duration @import controllers.CodeApp @import utils.AutoLinkRenderer @autoLinkedMsg(msg:String) = @{ val autoLinkRenderer = new AutoLinkRenderer(msg, project) autoLinkRenderer.render(null) } @getFilesURL = @{ if(selectedBranch){ routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, URLEncoder.encode(selectedBranch, "UTF-8"), "") } else { routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, "HEAD", "") } } @getHistoryURL(path:String) = @{ if(selectedBranch){ routes.CodeHistoryApp.history(project.owner, project.name, URLEncoder.encode(selectedBranch, "UTF-8"), path) } else { routes.CodeHistoryApp.historyUntilHead(project.owner, project.name) } } @getShowCommitURL(project:Project, commit:playRepository.Commit, path:String) = @{ if(selectedBranch){ var queryString = "?branch=" + URLEncoder.encode(selectedBranch, "UTF-8") if(path != null) { queryString += "&path=" + path + "#" + path.replace("/", "-").replace(".", "-") } routes.CodeHistoryApp.show(project.owner, project.name, commit.getId()) + queryString } else { routes.CodeHistoryApp.show(project.owner, project.name, commit.getId()) } } @getCorrectedPath(filePath:String, fileName:String) = @{ if((filePath != "") && (filePath.substring(filePath.length() - 1) == "/")){ filePath + fileName } else { filePath + "/" + fileName } } @makeBreadCrumbs(pagePath:String) = @{ if(pagePath != null){ var basePath = routes.CodeHistoryApp.history(project.owner, project.name, URLEncoder.encode(selectedBranch, "UTF-8"), null).toString() var partialPath = "" pagePath.split("/").toList.map { p => if(partialPath == ""){ partialPath = p } else { partialPath = partialPath + "/" + p } Html("" + p + "") } } } @isHistoryExistAndHasParent(history: List[playRepository.Commit]) = @{ (history.size > 0 && history.get(history.size - 1).getParentCount() > 0) } @projectLayout(Messages("title.commitHistory"), project, utils.MenuType.CODE) { @projectMenu(project, utils.MenuType.CODE, "main-menu-only")
@if(path != null){
} @if(path == null){
}

@{"@"} | @Messages("code.commitMsg") @if(path != null){ | } | @if(project.isGit) { @Messages("code.authorDate") } else { @Messages("code.commitDate") } | @Messages("code.author")
@if(history.isEmpty()){
@Messages("code.nocommits")
} @for(commit <- history.iterator) { @defining(getShowCommitURL(project, commit, path)){ showCommitURL =>
@commit.getShortId() | @defining( if(project.isGit()) { CommentThread.count(null, commit.getId, path) } else { CommitComment.count(project, commit.getId, path) }){ numOfComment => @if(numOfComment > 0) { @numOfComment } } @common.commitMsg(commit.getShortMessage(), autoLinkedMsg(commit.getMessage()), showCommitURL.toString()) @if(path != null){ | @Messages("code.showCode") } | @agoOrDateString(commit.getAuthorDate) | @(commit.getAuthor, commit.getAuthorEmail, commit.getAuthorName) match { case (user: User, _, _) if !user.isAnonymous => { @if(user.avatarUrl == UserApp.DEFAULT_AVATAR_URL){ @if(commit.getAuthorEmail != null) { } else { } } else { } } case (_, email, _) if email != null => { } case (_, _, name) if name != null => { @commit.getAuthorName } case (_, _, _) => { @User.anonymous.name } }
} }

@if(page > 0) { @Messages("code.newer") } @if(isHistoryExistAndHasParent(history)) { @Messages("code.older") }
@common.select2()
}