You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

commit_page.tmpl 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. {{template "base/head" .}}
  2. <div role="main" aria-label="{{.Title}}" class="page-content repository diff">
  3. {{template "repo/header" .}}
  4. <div class="ui container fluid padded">
  5. {{$class := ""}}
  6. {{if .Commit.Signature}}
  7. {{$class = (print $class " isSigned")}}
  8. {{if .Verification.Verified}}
  9. {{if eq .Verification.TrustStatus "trusted"}}
  10. {{$class = (print $class " isVerified")}}
  11. {{else if eq .Verification.TrustStatus "untrusted"}}
  12. {{$class = (print $class " isVerifiedUntrusted")}}
  13. {{else}}
  14. {{$class = (print $class " isVerifiedUnmatched")}}
  15. {{end}}
  16. {{else if .Verification.Warning}}
  17. {{$class = (print $class " isWarning")}}
  18. {{end}}
  19. {{end}}
  20. <div class="ui top attached header clearing segment gt-relative commit-header {{$class}}">
  21. <div class="gt-df gt-mb-4 gt-fw">
  22. <h3 class="gt-mb-0 gt-f1"><span class="commit-summary" title="{{.Commit.Summary}}">{{RenderCommitMessage $.Context .Commit.Message $.Repository.ComposeMetas}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses "root" $}}</h3>
  23. {{if not $.PageIsWiki}}
  24. <div>
  25. <a class="ui primary tiny button" href="{{.SourcePath}}">
  26. {{ctx.Locale.Tr "repo.diff.browse_source"}}
  27. </a>
  28. {{if and ($.Permission.CanWrite $.UnitTypeCode) (not $.Repository.IsArchived) (not .IsDeleted)}}{{- /* */ -}}
  29. <div class="ui dropdown primary tiny button">
  30. {{ctx.Locale.Tr "repo.commit.operations"}}
  31. {{svg "octicon-triangle-down" 14 "dropdown icon"}}
  32. <div class="menu">
  33. <div class="ui header">{{ctx.Locale.Tr "repo.commit.operations"}}</div>
  34. <div class="divider"></div>
  35. <div class="item show-create-branch-modal"
  36. data-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" (.CommitID)}}" {{/* used by the form */}}
  37. data-branch-from="{{ShortSha .CommitID}}"
  38. data-branch-from-urlcomponent="{{.CommitID}}"
  39. data-modal="#create-branch-modal">
  40. {{ctx.Locale.Tr "repo.branch.create_branch_operation"}}
  41. </div>
  42. <div class="item show-create-branch-modal"
  43. data-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" (.CommitID)}}" {{/* used by the form */}}
  44. data-branch-from="{{ShortSha .CommitID}}"
  45. data-branch-from-urlcomponent="{{.CommitID}}"
  46. data-modal="#create-tag-modal"
  47. data-modal-from-span="#modal-create-tag-from-span"
  48. data-modal-form="#create-tag-form">
  49. {{ctx.Locale.Tr "repo.tag.create_tag_operation"}}
  50. </div>
  51. <div class="item show-modal revert-button"
  52. data-modal="#cherry-pick-modal"
  53. data-modal-cherry-pick-type="revert"
  54. data-modal-cherry-pick-header="{{ctx.Locale.Tr "repo.commit.revert-header" (ShortSha .CommitID)}}"
  55. data-modal-cherry-pick-content="{{ctx.Locale.Tr "repo.commit.revert-content"}}"
  56. data-modal-cherry-pick-submit="{{ctx.Locale.Tr "repo.commit.revert"}}">{{ctx.Locale.Tr "repo.commit.revert"}}</div>
  57. <div class="item cherry-pick-button show-modal"
  58. data-modal="#cherry-pick-modal"
  59. data-modal-cherry-pick-type="cherry-pick"
  60. data-modal-cherry-pick-header="{{ctx.Locale.Tr "repo.commit.cherry-pick-header" (ShortSha .CommitID)}}"
  61. data-modal-cherry-pick-content="{{ctx.Locale.Tr "repo.commit.cherry-pick-content"}}"
  62. data-modal-cherry-pick-submit="{{ctx.Locale.Tr "repo.commit.cherry-pick"}}">{{ctx.Locale.Tr "repo.commit.cherry-pick"}}</div>
  63. <div class="ui g-modal-confirm modal" id="cherry-pick-modal">
  64. <div class="header">
  65. <span id="cherry-pick-header"></span>
  66. </div>
  67. <div class="content">
  68. <p id="cherry-pick-content" class="branch-dropdown"></p>
  69. {{template "repo/branch_dropdown" dict "root" .
  70. "noTag" true "disableCreateBranch" true
  71. "branchForm" "branch-dropdown-form"
  72. "branchURLPrefix" (printf "%s/_cherrypick/%s/" $.RepoLink .CommitID) "branchURLSuffix" ""
  73. "setAction" true "submitForm" true}}
  74. <form method="get" action="{{$.RepoLink}}/_cherrypick/{{.CommitID}}/{{if $.BranchName}}{{PathEscapeSegments $.BranchName}}{{else}}{{PathEscapeSegments $.Repository.DefaultBranch}}{{end}}" id="branch-dropdown-form">
  75. <input type="hidden" name="ref" value="{{if $.BranchName}}{{$.BranchName}}{{else}}{{$.Repository.DefaultBranch}}{{end}}">
  76. <input type="hidden" name="refType" value="branch">
  77. <input type="hidden" id="cherry-pick-type" name="cherry-pick-type"><br>
  78. <button type="submit" id="cherry-pick-submit" class="ui primary button"></button>
  79. </form>
  80. </div>
  81. </div>
  82. <div class="ui small modal" id="create-branch-modal">
  83. <div class="header">
  84. {{ctx.Locale.Tr "repo.branch.new_branch"}}
  85. </div>
  86. <div class="content">
  87. <form class="ui form" id="create-branch-form" action="" data-base-action="{{.RepoLink}}/branches/_new/commit/" method="post">
  88. {{.CsrfTokenHtml}}
  89. <div class="field">
  90. <label>
  91. {{ctx.Locale.Tr "repo.branch.new_branch_from" "<span class=\"text\" id=\"modal-create-branch-from-span\"></span>" | Safe}}
  92. </label>
  93. </div>
  94. <div class="required field">
  95. <label for="new_branch_name">{{ctx.Locale.Tr "repo.branch.name"}}</label>
  96. <input id="new_branch_name" name="new_branch_name" required>
  97. </div>
  98. <div class="text right actions">
  99. <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
  100. <button class="ui primary button">{{ctx.Locale.Tr "repo.branch.confirm_create_branch"}}</button>
  101. </div>
  102. </form>
  103. </div>
  104. </div>
  105. <div class="ui small modal" id="create-tag-modal">
  106. <div class="header">
  107. {{ctx.Locale.Tr "repo.tag.create_tag_operation"}}
  108. </div>
  109. <div class="content">
  110. <form class="ui form" id="create-tag-form" action="" data-base-action="{{.RepoLink}}/branches/_new/commit/" method="post">
  111. {{.CsrfTokenHtml}}
  112. <input type="hidden" name="create_tag" value="true">
  113. <div class="field">
  114. <label>
  115. {{ctx.Locale.Tr "repo.tag.create_tag_from" "<span class=\"text\" id=\"modal-create-tag-from-span\"></span>" | Safe}}
  116. </label>
  117. </div>
  118. <div class="required field">
  119. <label for="new_branch_name">{{ctx.Locale.Tr "repo.release.tag_name"}}</label>
  120. <input id="new_branch_name" name="new_branch_name" required>
  121. </div>
  122. <div class="text right actions">
  123. <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
  124. <button class="ui primary button">{{ctx.Locale.Tr "repo.tag.confirm_create_tag"}}</button>
  125. </div>
  126. </form>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. {{end}}
  132. </div>
  133. {{end}}
  134. </div>
  135. {{if IsMultilineCommitMessage .Commit.Message}}
  136. <pre class="commit-body">{{RenderCommitBody $.Context .Commit.Message $.Repository.ComposeMetas}}</pre>
  137. {{end}}
  138. {{template "repo/commit_load_branches_and_tags" .}}
  139. </div>
  140. <div class="ui attached segment gt-df gt-ac gt-sb gt-py-2 commit-header-row gt-fw {{$class}}">
  141. <div class="gt-df gt-ac author">
  142. {{if .Author}}
  143. {{ctx.AvatarUtils.Avatar .Author 28 "gt-mr-3"}}
  144. {{if .Author.FullName}}
  145. <a href="{{.Author.HomeLink}}"><strong>{{.Author.FullName}}</strong></a>
  146. {{else}}
  147. <a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
  148. {{end}}
  149. {{else}}
  150. {{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 28 "gt-mr-3"}}
  151. <strong>{{.Commit.Author.Name}}</strong>
  152. {{end}}
  153. <span class="text grey gt-ml-3" id="authored-time">{{TimeSince .Commit.Author.When ctx.Locale}}</span>
  154. {{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}}
  155. <span class="text grey gt-mx-3">{{ctx.Locale.Tr "repo.diff.committed_by"}}</span>
  156. {{if ne .Verification.CommittingUser.ID 0}}
  157. {{ctx.AvatarUtils.Avatar .Verification.CommittingUser 28 "gt-mx-3"}}
  158. <a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a>
  159. {{else}}
  160. {{ctx.AvatarUtils.AvatarByEmail .Commit.Committer.Email .Commit.Committer.Name 28 "gt-mr-3"}}
  161. <strong>{{.Commit.Committer.Name}}</strong>
  162. {{end}}
  163. {{end}}
  164. </div>
  165. <div class="ui horizontal list gt-df gt-ac">
  166. {{if .Parents}}
  167. <div class="item">
  168. <span>{{ctx.Locale.Tr "repo.diff.parent"}}</span>
  169. {{range .Parents}}
  170. {{if $.PageIsWiki}}
  171. <a class="ui primary sha label" href="{{$.RepoLink}}/wiki/commit/{{PathEscape .}}">{{ShortSha .}}</a>
  172. {{else}}
  173. <a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{PathEscape .}}">{{ShortSha .}}</a>
  174. {{end}}
  175. {{end}}
  176. </div>
  177. {{end}}
  178. <div class="item">
  179. <span>{{ctx.Locale.Tr "repo.diff.commit"}}</span>
  180. <span class="ui primary sha label">{{ShortSha .CommitID}}</span>
  181. </div>
  182. </div>
  183. </div>
  184. {{if .Commit.Signature}}
  185. <div class="ui bottom attached message gt-text-left gt-df gt-ac gt-sb commit-header-row gt-fw {{$class}}">
  186. <div class="gt-df gt-ac">
  187. {{if .Verification.Verified}}
  188. {{if ne .Verification.SigningUser.ID 0}}
  189. {{svg "gitea-lock" 16 "gt-mr-3"}}
  190. {{if eq .Verification.TrustStatus "trusted"}}
  191. <span class="ui text gt-mr-3">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span>
  192. {{else if eq .Verification.TrustStatus "untrusted"}}
  193. <span class="ui text gt-mr-3">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user"}}:</span>
  194. {{else}}
  195. <span class="ui text gt-mr-3">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}:</span>
  196. {{end}}
  197. {{ctx.AvatarUtils.Avatar .Verification.SigningUser 28 "gt-mr-3"}}
  198. <a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.GetDisplayName}}</strong></a>
  199. {{else}}
  200. <span title="{{ctx.Locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16 "gt-mr-3"}}</span>
  201. <span class="ui text gt-mr-3">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span>
  202. {{ctx.AvatarUtils.AvatarByEmail .Verification.SigningEmail "" 28 "gt-mr-3"}}
  203. <strong>{{.Verification.SigningUser.GetDisplayName}}</strong>
  204. {{end}}
  205. {{else}}
  206. {{svg "gitea-unlock" 16 "gt-mr-3"}}
  207. <span class="ui text">{{ctx.Locale.Tr .Verification.Reason}}</span>
  208. {{end}}
  209. </div>
  210. <div class="gt-df gt-ac">
  211. {{if .Verification.Verified}}
  212. {{if ne .Verification.SigningUser.ID 0}}
  213. {{svg "octicon-verified" 16 "gt-mr-3"}}
  214. {{if .Verification.SigningSSHKey}}
  215. <span class="ui text gt-mr-3">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
  216. {{.Verification.SigningSSHKey.Fingerprint}}
  217. {{else}}
  218. <span class="ui text gt-mr-3">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
  219. {{.Verification.SigningKey.PaddedKeyID}}
  220. {{end}}
  221. {{else}}
  222. {{svg "octicon-unverified" 16 "gt-mr-3"}}
  223. {{if .Verification.SigningSSHKey}}
  224. <span class="ui text gt-mr-3" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
  225. {{.Verification.SigningSSHKey.Fingerprint}}
  226. {{else}}
  227. <span class="ui text gt-mr-3" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
  228. {{.Verification.SigningKey.PaddedKeyID}}
  229. {{end}}
  230. {{end}}
  231. {{else if .Verification.Warning}}
  232. {{svg "octicon-unverified" 16 "gt-mr-3"}}
  233. {{if .Verification.SigningSSHKey}}
  234. <span class="ui text gt-mr-3">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
  235. {{.Verification.SigningSSHKey.Fingerprint}}
  236. {{else}}
  237. <span class="ui text gt-mr-3">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
  238. {{.Verification.SigningKey.PaddedKeyID}}
  239. {{end}}
  240. {{else}}
  241. {{if .Verification.SigningKey}}
  242. {{if ne .Verification.SigningKey.KeyID ""}}
  243. {{svg "octicon-verified" 16 "gt-mr-3"}}
  244. <span class="ui text gt-mr-3">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
  245. {{.Verification.SigningKey.PaddedKeyID}}
  246. {{end}}
  247. {{end}}
  248. {{if .Verification.SigningSSHKey}}
  249. {{if ne .Verification.SigningSSHKey.Fingerprint ""}}
  250. {{svg "octicon-verified" 16 "gt-mr-3"}}
  251. <span class="ui text gt-mr-3">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
  252. {{.Verification.SigningSSHKey.Fingerprint}}
  253. {{end}}
  254. {{end}}
  255. {{end}}
  256. </div>
  257. </div>
  258. {{end}}
  259. {{if .NoteRendered}}
  260. <div class="ui top attached header segment git-notes">
  261. {{svg "octicon-note" 16 "gt-mr-3"}}
  262. {{ctx.Locale.Tr "repo.diff.git-notes"}}:
  263. {{if .NoteAuthor}}
  264. <a href="{{.NoteAuthor.HomeLink}}">
  265. {{if .NoteAuthor.FullName}}
  266. <strong>{{.NoteAuthor.FullName}}</strong>
  267. {{else}}
  268. <strong>{{.NoteCommit.Author.Name}}</strong>
  269. {{end}}
  270. </a>
  271. {{else}}
  272. <strong>{{.NoteCommit.Author.Name}}</strong>
  273. {{end}}
  274. <span class="text grey" id="note-authored-time">{{TimeSince .NoteCommit.Author.When ctx.Locale}}</span>
  275. </div>
  276. <div class="ui bottom attached info segment git-notes">
  277. <pre class="commit-body">{{.NoteRendered | Str2html}}</pre>
  278. </div>
  279. {{end}}
  280. {{template "repo/diff/box" .}}
  281. </div>
  282. </div>
  283. {{template "base/footer" .}}