gitea源码

commits_list.tmpl 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <div class="ui attached table segment commit-table">
  2. <table class="ui very basic striped table unstackable" id="commits-table">
  3. <thead>
  4. <tr>
  5. <th class="three wide">{{ctx.Locale.Tr "repo.commits.author"}}</th>
  6. <th class="two wide sha">{{StringUtils.ToUpper $.Repository.ObjectFormatName}}</th>
  7. <th class="eight wide message">{{ctx.Locale.Tr "repo.commits.message"}}</th>
  8. <th class="two wide tw-text-right">{{ctx.Locale.Tr "repo.commits.date"}}</th>
  9. <th class="one wide"></th>
  10. </tr>
  11. </thead>
  12. <tbody class="commit-list">
  13. {{$commitRepoLink := $.RepoLink}}{{if $.CommitRepoLink}}{{$commitRepoLink = $.CommitRepoLink}}{{end}}
  14. {{range .Commits}}
  15. <tr>
  16. <td class="author">
  17. <div class="tw-flex">
  18. {{$userName := .Author.Name}}
  19. {{if .User}}
  20. {{if and .User.FullName DefaultShowFullName}}
  21. {{$userName = .User.FullName}}
  22. {{end}}
  23. {{ctx.AvatarUtils.Avatar .User 28 "tw-mr-2"}}<a class="muted author-wrapper" href="{{.User.HomeLink}}">{{$userName}}</a>
  24. {{else}}
  25. {{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 28 "tw-mr-2"}}
  26. <span class="author-wrapper">{{$userName}}</span>
  27. {{end}}
  28. </div>
  29. </td>
  30. <td class="sha">
  31. {{$commitBaseLink := ""}}
  32. {{if $.PageIsWiki}}
  33. {{$commitBaseLink = printf "%s/wiki/commit" $commitRepoLink}}
  34. {{else if $.PageIsPullCommits}}
  35. {{$commitBaseLink = printf "%s/pulls/%d/commits" $commitRepoLink $.Issue.Index}}
  36. {{else if $.Reponame}}
  37. {{$commitBaseLink = printf "%s/commit" $commitRepoLink}}
  38. {{end}}
  39. {{template "repo/commit_sign_badge" dict "Commit" . "CommitBaseLink" $commitBaseLink "CommitSignVerification" .Verification}}
  40. </td>
  41. <td class="message">
  42. <span class="message-wrapper">
  43. {{if $.PageIsWiki}}
  44. <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | ctx.RenderUtils.RenderEmoji}}</span>
  45. {{else}}
  46. {{$commitLink:= printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String)}}
  47. <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink $.Repository}}</span>
  48. {{end}}
  49. </span>
  50. {{if IsMultilineCommitMessage .Message}}
  51. <button class="ui button ellipsis-button" aria-expanded="false" data-global-click="onRepoEllipsisButtonClick">...</button>
  52. {{end}}
  53. {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}}
  54. {{if IsMultilineCommitMessage .Message}}
  55. <pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .Message $.Repository}}</pre>
  56. {{end}}
  57. {{if $.CommitsTagsMap}}
  58. {{range (index $.CommitsTagsMap .ID.String)}}
  59. {{- template "repo/tag/name" dict "AdditionalClasses" "tw-py-0" "RepoLink" $.Repository.Link "TagName" .TagName "IsRelease" (not .IsTag) -}}
  60. {{end}}
  61. {{end}}
  62. </td>
  63. {{if .Committer}}
  64. <td class="tw-text-right">{{DateUtils.TimeSince .Committer.When}}</td>
  65. {{else}}
  66. <td class="tw-text-right">{{DateUtils.TimeSince .Author.When}}</td>
  67. {{end}}
  68. <td class="tw-text-right tw-py-0">
  69. <button class="btn interact-bg tw-p-2 copy-commit-id" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button>
  70. {{/* at the moment, wiki doesn't support these "view" links like "view at history point" */}}
  71. {{if not $.PageIsWiki}}
  72. {{/* view single file diff */}}
  73. {{if $.FileTreePath}}
  74. <a class="btn interact-bg tw-p-2 view-single-diff" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_file_diff"}}"
  75. href="{{$commitRepoLink}}/commit/{{.ID.String}}?files={{$.FileTreePath}}"
  76. >{{svg "octicon-file-diff"}}</a>
  77. {{end}}
  78. {{/* view at history point */}}
  79. {{$viewCommitLink := printf "%s/src/commit/%s" $commitRepoLink (PathEscape .ID.String)}}
  80. {{if $.FileTreePath}}{{$viewCommitLink = printf "%s/%s" $viewCommitLink (PathEscapeSegments $.FileTreePath)}}{{end}}
  81. <a class="btn interact-bg tw-p-2 view-commit-path" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{$viewCommitLink}}">{{svg "octicon-file-code"}}</a>
  82. {{end}}
  83. </td>
  84. </tr>
  85. {{end}}
  86. </tbody>
  87. </table>
  88. </div>