gitea源码

commits.tmpl 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <div id="rev-container">
  2. <ul id="rev-list">
  3. {{range $commitI, $commit := .Graph.Commits}}
  4. <li {{if $commit.Rev}}id="commit-{{$commit.Rev}}"{{end}} data-flow="{{$commit.Flow}}">
  5. {{if $commit.OnlyRelation}}
  6. <span></span>
  7. {{else}}
  8. {{/* every field must be in a span to get correctly styled */}}
  9. <span>
  10. {{template "repo/commit_sign_badge" dict "Commit" $commit.Commit "CommitBaseLink" (print $.RepoLink "/commit") "CommitSignVerification" $commit.Verification}}
  11. </span>
  12. <span class="message tw-inline-block gt-ellipsis">
  13. {{ctx.RenderUtils.RenderCommitMessage $commit.Subject $.Repository}}
  14. </span>
  15. <span class="commit-refs flex-text-inline">
  16. {{range $commit.Refs}}
  17. {{$refGroup := .RefGroup}}
  18. {{if eq $refGroup "pull"}}
  19. {{if or (not $.HidePRRefs) (SliceUtils.Contains $.SelectedBranches .Name)}}
  20. <!-- it's intended to use issues not pulls, if it's a pull you will get redirected -->
  21. <a class="ui basic tiny button" href="{{$.RepoLink}}/{{if $.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypePullRequests}}pulls{{else}}issues{{end}}/{{.ShortName|PathEscape}}">
  22. {{svg "octicon-git-pull-request"}} #{{.ShortName}}
  23. </a>
  24. {{end}}
  25. {{else if eq $refGroup "tags"}}
  26. {{- template "repo/tag/name" dict "AdditionalClasses" "tag-label" "RepoLink" $.Repository.Link "TagName" .ShortName -}}
  27. {{else if eq $refGroup "remotes"}}
  28. <a class="ui basic tiny button" href="{{$.RepoLink}}/src/commit/{{$commit.Rev|PathEscape}}">
  29. {{svg "octicon-cross-reference"}} {{.ShortName}}
  30. </a>
  31. {{else if eq $refGroup "heads"}}
  32. <a class="ui basic tiny button" href="{{$.RepoLink}}/src/branch/{{.ShortName|PathEscape}}">
  33. {{svg "octicon-git-branch"}} {{.ShortName}}
  34. </a>
  35. {{else}}
  36. <!-- Unknown ref type .Name -->
  37. {{end}}
  38. {{end}}
  39. </span>
  40. <span class="author flex-text-inline">
  41. {{$userName := $commit.Commit.Author.Name}}
  42. {{if $commit.User}}
  43. {{if and $commit.User.FullName DefaultShowFullName}}
  44. {{$userName = $commit.User.FullName}}
  45. {{end}}
  46. {{ctx.AvatarUtils.Avatar $commit.User 18}}
  47. <a href="{{$commit.User.HomeLink}}">{{$userName}}</a>
  48. {{else}}
  49. {{ctx.AvatarUtils.AvatarByEmail $commit.Commit.Author.Email $userName 18}}
  50. {{$userName}}
  51. {{end}}
  52. </span>
  53. <span class="time flex-text-inline">{{DateUtils.FullTime $commit.Date}}</span>
  54. {{end}}
  55. </li>
  56. {{end}}
  57. </ul>
  58. </div>