diff --git a/modules/templates/helper.go b/modules/templates/helper.go index bdcaa1275..2d7a1aee9 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -246,6 +246,18 @@ func NewFuncMap() []template.FuncMap { "MirrorFullAddress": mirror_service.AddressNoCredentials, "MirrorUserName": mirror_service.Username, "MirrorPassword": mirror_service.Password, + "CommitType": func(commit interface{}) string { + switch commit.(type) { + case models.SignCommitWithStatuses: + return "SignCommitWithStatuses" + case models.SignCommit: + return "SignCommit" + case models.UserCommit: + return "UserCommit" + default: + return "" + } + }, }} } diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl new file mode 100644 index 000000000..177c43472 --- /dev/null +++ b/templates/repo/commits_list.tmpl @@ -0,0 +1,87 @@ +
+ + + + + + + + + + + {{ $r:= List .Commits}} + {{range $r}} + + + + + + + {{end}} + +
{{.i18n.Tr "repo.commits.author"}}SHA1{{.i18n.Tr "repo.commits.message"}}{{.i18n.Tr "repo.commits.date"}}
+ {{$userName := .Author.Name}} + {{if .User}} + {{if .User.FullName}} + {{$userName = .User.FullName}} + {{end}} +   {{$userName}} + {{else}} +   {{$userName}} + {{end}} + + {{$class := "ui sha label"}} + {{if .Signature}} + {{$class = (printf "%s%s" $class " isSigned")}} + {{if .Verification.Verified}} + {{$class = (printf "%s%s" $class " isVerified")}} + {{else if .Verification.Warning}} + {{$class = (printf "%s%s" $class " isWarning")}} + {{end}} + {{end}} + {{if $.Reponame}} + + {{else}} + + {{end}} + {{ShortSha .ID.String}} + {{if .Signature}} +
+ {{if .Verification.Verified}} + + {{if ne .Verification.SigningUser.ID 0}} + + {{else}} + + + + + {{end}} + {{else if .Verification.Warning}} + + {{else}} + + {{end}} +
+ {{end}} + {{if $.Reponame}} +
+ {{else}} + + {{end}} +
+ + {{ $commitLink:= printf "%s/%s/%s/commit/%s" AppSubUrl $.Username $.Reponame .ID }} + {{RenderCommitMessageLinkSubject .Message $.RepoLink $commitLink $.Repository.ComposeMetas}} + + {{if IsMultilineCommitMessage .Message}} + + {{end}} + {{if eq (CommitType .) "SignCommitWithStatuses"}} + {{template "repo/commit_status" .Status}} + {{end}} + {{if IsMultilineCommitMessage .Message}} + + {{end}} + {{TimeSince .Author.When $.Lang}}
+
diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index 09a2c072b..93c321cbe 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -30,73 +30,7 @@ {{if and .Commits (gt .CommitCount 0)}} -
- - - - - - - - - - - {{ $r:= List .Commits}} - {{range $r}} - - - - - - - {{end}} - -
{{.i18n.Tr "repo.commits.author"}}SHA1{{.i18n.Tr "repo.commits.message"}}{{.i18n.Tr "repo.commits.date"}}
- {{if .User}} - {{if .User.FullName}} -   {{.User.FullName}} - {{else}} -   {{.Author.Name}} - {{end}} - {{else}} -   {{.Author.Name}} - {{end}} - - - {{ShortSha .ID.String}} - {{if .Signature}} -
- {{if .Verification.Verified}} - {{if ne .Verification.SigningUser.ID 0}} - - {{else}} - - - - - {{end}} - {{else if .Verification.Warning}} - - {{else}} - - {{end}} -
- {{end}} -
-
- - {{ $commitLink:= printf "%s/%s/%s/commit/%s" AppSubUrl $.Username $.Reponame .ID }} - {{RenderCommitMessageLinkSubject .Message $.RepoLink $commitLink $.Repository.ComposeMetas}} - - {{if IsMultilineCommitMessage .Message}} - - {{end}} - {{template "repo/commit_status" .Status}} - {{if IsMultilineCommitMessage .Message}} - - {{end}} - {{TimeSince .Author.When $.Lang}}
-
+ {{template "repo/commits_list" .}} {{end}} {{template "base/paginate" .}} diff --git a/templates/repo/wiki/revision.tmpl b/templates/repo/wiki/revision.tmpl index c3a4f7636..13d3a6227 100644 --- a/templates/repo/wiki/revision.tmpl +++ b/templates/repo/wiki/revision.tmpl @@ -48,60 +48,7 @@ {{if and .Commits (gt .CommitCount 0)}} -
- - - - - - - - - - - {{ $r:= List .Commits}} - {{range $r}} - - - - - - - {{end}} - -
{{.i18n.Tr "repo.commits.author"}}SHA1{{.i18n.Tr "repo.commits.message"}}{{.i18n.Tr "repo.commits.date"}}
- {{if .User}} - {{if .User.FullName}} -   {{.User.FullName}} - {{else}} -   {{.Author.Name}} - {{end}} - {{else}} -   {{.Author.Name}} - {{end}} - - - - - {{.Summary}} - {{if IsMultilineCommitMessage .Message}} - - - {{end}} - - {{TimeSince .Author.When $.Lang}}
-
+ {{template "repo/commits_list" .}} {{end}} {{template "base/paginate" .}}