本站源代码
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

267 lines
11KB

  1. {{if gt (len .PullReviewersWithType) 0}}
  2. <div class="comment box">
  3. <div class="content">
  4. <div class="ui segment">
  5. <h4>{{$.i18n.Tr "repo.issues.review.reviewers"}}</h4>
  6. {{range .PullReviewersWithType}}
  7. {{ $createdStr:= TimeSinceUnix .ReviewUpdatedUnix $.Lang }}
  8. <div class="ui divider"></div>
  9. <div class="review-item">
  10. <span class="type-icon text {{if eq .Type 1}}green
  11. {{else if eq .Type 2}}grey
  12. {{else if eq .Type 3}}red
  13. {{else}}grey{{end}}">
  14. <span class="octicon octicon-{{.Type.Icon}}"></span>
  15. </span>
  16. <a class="ui avatar image" href="{{.HomeLink}}">
  17. <img src="{{.RelAvatarLink}}">
  18. </a>
  19. <span class="text grey"><a href="{{.HomeLink}}">{{.Name}}</a>
  20. {{if eq .Type 1}}
  21. {{$.i18n.Tr "repo.issues.review.approve" $createdStr | Safe}}
  22. {{else if eq .Type 2}}
  23. {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}}
  24. {{else if eq .Type 3}}
  25. {{$.i18n.Tr "repo.issues.review.reject" $createdStr | Safe}}
  26. {{else}}
  27. {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}}
  28. {{end}}
  29. </span>
  30. </div>
  31. {{end}}
  32. </div>
  33. </div>
  34. </div>
  35. {{end}}
  36. <div class="comment merge box">
  37. <a class="avatar text
  38. {{if .Issue.PullRequest.HasMerged}}purple
  39. {{else if .Issue.IsClosed}}grey
  40. {{else if .IsPullWorkInProgress}}grey
  41. {{else if .IsFilesConflicted}}grey
  42. {{else if .IsPullRequestBroken}}red
  43. {{else if .IsBlockedByApprovals}}red
  44. {{else if and .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}}red
  45. {{else if .Issue.PullRequest.IsChecking}}yellow
  46. {{else if .Issue.PullRequest.CanAutoMerge}}green
  47. {{else}}red{{end}}"><span class="mega-octicon octicon-git-merge"></span></a>
  48. <div class="content">
  49. {{template "repo/pulls/status" .}}
  50. <div class="ui {{if not $.LatestCommitStatus}}top attached header{{else}}attached merge-section segment{{end}}">
  51. {{if .Issue.PullRequest.HasMerged}}
  52. <div class="item text purple">
  53. {{if .Issue.PullRequest.MergedCommitID}}
  54. {{$link := printf "%s/commit/%s" $.Repository.HTMLURL .Issue.PullRequest.MergedCommitID}}
  55. {{$.i18n.Tr "repo.pulls.merged_as" $link (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}}
  56. {{else}}
  57. {{$.i18n.Tr "repo.pulls.has_merged"}}
  58. {{end}}
  59. </div>
  60. {{if .IsPullBranchDeletable}}
  61. <div class="ui divider"></div>
  62. <div>
  63. <a class="delete-button ui red button" href="" data-url="{{.DeleteBranchLink}}">{{$.i18n.Tr "repo.branch.delete" .HeadTarget}}</a>
  64. </div>
  65. {{end}}
  66. {{else if .Issue.IsClosed}}
  67. <div class="item text grey">
  68. {{if .IsPullRequestBroken}}
  69. {{$.i18n.Tr "repo.pulls.cant_reopen_deleted_branch"}}
  70. {{else}}
  71. {{$.i18n.Tr "repo.pulls.reopen_to_merge"}}
  72. {{end}}
  73. </div>
  74. {{if .IsPullBranchDeletable}}
  75. <div class="ui divider"></div>
  76. <div>
  77. <a class="delete-button ui red button" href="" data-url="{{.DeleteBranchLink}}">{{$.i18n.Tr "repo.branch.delete" .HeadTarget}}</a>
  78. </div>
  79. {{end}}
  80. {{else if .IsPullFilesConflicted}}
  81. <div class="item text grey">
  82. <span class="octicon octicon-x"></span>
  83. {{$.i18n.Tr "repo.pulls.files_conflicted"}}
  84. {{range .ConflictedFiles}}
  85. <div>{{.}}</div>
  86. {{end}}
  87. </div>
  88. {{else if .IsPullRequestBroken}}
  89. <div class="item text red">
  90. <span class="octicon octicon-x"></span>
  91. {{$.i18n.Tr "repo.pulls.data_broken"}}
  92. </div>
  93. {{else if .IsPullWorkInProgress}}
  94. <div class="item text grey">
  95. <span class="octicon octicon-x"></span>
  96. {{$.i18n.Tr "repo.pulls.cannot_merge_work_in_progress" .WorkInProgressPrefix | Str2html}}
  97. </div>
  98. {{else if .IsBlockedByApprovals}}
  99. <div class="item text red">
  100. <span class="octicon octicon-x"></span>
  101. {{$.i18n.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}}
  102. </div>
  103. {{else if .Issue.PullRequest.IsChecking}}
  104. <div class="item text yellow">
  105. <span class="octicon octicon-sync"></span>
  106. {{$.i18n.Tr "repo.pulls.is_checking"}}
  107. </div>
  108. {{else if and (not .Issue.PullRequest.CanAutoMerge) .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}}
  109. <div class="item text red">
  110. <span class="octicon octicon-x"></span>
  111. {{$.i18n.Tr "repo.pulls.required_status_check_failed"}}
  112. </div>
  113. {{else if .Issue.PullRequest.CanAutoMerge}}
  114. {{if and .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}}
  115. <div class="item text red">
  116. <span class="octicon octicon-x"></span>
  117. {{$.i18n.Tr "repo.pulls.required_status_check_failed"}}
  118. </div>
  119. {{end}}
  120. {{if or $.IsRepoAdmin (not .EnableStatusCheck) .IsRequiredStatusCheckSuccess}}
  121. {{if and $.IsRepoAdmin .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}}
  122. <div class="item text yellow">
  123. <span class="octicon octicon-primitive-dot"></span>
  124. {{$.i18n.Tr "repo.pulls.required_status_check_administrator"}}
  125. </div>
  126. {{else}}
  127. <div class="item text green">
  128. <span class="octicon octicon-check"></span>
  129. {{$.i18n.Tr "repo.pulls.can_auto_merge_desc"}}
  130. </div>
  131. {{end}}
  132. {{if .AllowMerge}}
  133. {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}}
  134. {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash}}
  135. <div class="ui divider"></div>
  136. {{if $prUnit.PullRequestsConfig.AllowMerge}}
  137. <div class="ui form merge-fields" style="display: none">
  138. <form action="{{.Link}}/merge" method="post">
  139. {{.CsrfTokenHtml}}
  140. <div class="field">
  141. <input type="text" name="merge_title_field" value="{{.Issue.PullRequest.GetDefaultMergeMessage}}">
  142. </div>
  143. <div class="field">
  144. <textarea name="merge_message_field" rows="5" placeholder="{{$.i18n.Tr "repo.editor.commit_message_desc"}}"></textarea>
  145. </div>
  146. <button class="ui green button" type="submit" name="do" value="merge">
  147. {{$.i18n.Tr "repo.pulls.merge_pull_request"}}
  148. </button>
  149. <button class="ui button merge-cancel">
  150. {{$.i18n.Tr "cancel"}}
  151. </button>
  152. </form>
  153. </div>
  154. {{end}}
  155. {{if $prUnit.PullRequestsConfig.AllowRebase}}
  156. <div class="ui form rebase-fields" style="display: none">
  157. <form action="{{.Link}}/merge" method="post">
  158. {{.CsrfTokenHtml}}
  159. <button class="ui green button" type="submit" name="do" value="rebase">
  160. {{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}
  161. </button>
  162. <button class="ui button merge-cancel">
  163. {{$.i18n.Tr "cancel"}}
  164. </button>
  165. </form>
  166. </div>
  167. {{end}}
  168. {{if $prUnit.PullRequestsConfig.AllowRebaseMerge}}
  169. <div class="ui form rebase-merge-fields" style="display: none">
  170. <form action="{{.Link}}/merge" method="post">
  171. {{.CsrfTokenHtml}}
  172. <div class="field">
  173. <input type="text" name="merge_title_field" value="{{.Issue.PullRequest.GetDefaultMergeMessage}}">
  174. </div>
  175. <div class="field">
  176. <textarea name="merge_message_field" rows="5" placeholder="{{$.i18n.Tr "repo.editor.commit_message_desc"}}"></textarea>
  177. </div>
  178. <button class="ui green button" type="submit" name="do" value="rebase-merge">
  179. {{$.i18n.Tr "repo.pulls.rebase_merge_commit_pull_request"}}
  180. </button>
  181. <button class="ui button merge-cancel">
  182. {{$.i18n.Tr "cancel"}}
  183. </button>
  184. </form>
  185. </div>
  186. {{end}}
  187. {{if $prUnit.PullRequestsConfig.AllowSquash}}
  188. <div class="ui form squash-fields" style="display: none">
  189. <form action="{{.Link}}/merge" method="post">
  190. {{.CsrfTokenHtml}}
  191. <div class="field">
  192. <input type="text" name="merge_title_field" value="{{.Issue.PullRequest.GetDefaultSquashMessage}}">
  193. </div>
  194. <div class="field">
  195. <textarea name="merge_message_field" rows="5" placeholder="{{$.i18n.Tr "repo.editor.commit_message_desc"}}"></textarea>
  196. </div>
  197. <button class="ui green button" type="submit" name="do" value="squash">
  198. {{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}
  199. </button>
  200. <button class="ui button merge-cancel">
  201. {{$.i18n.Tr "cancel"}}
  202. </button>
  203. </form>
  204. </div>
  205. {{end}}
  206. <div class="ui green buttons merge-button">
  207. <button class="ui button" data-do="{{.MergeStyle}}">
  208. <span class="octicon octicon-git-merge"></span>
  209. <span class="button-text">
  210. {{if eq .MergeStyle "merge"}}
  211. {{$.i18n.Tr "repo.pulls.merge_pull_request"}}
  212. {{end}}
  213. {{if eq .MergeStyle "rebase"}}
  214. {{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}
  215. {{end}}
  216. {{if eq .MergeStyle "rebase-merge"}}
  217. {{$.i18n.Tr "repo.pulls.rebase_merge_commit_pull_request"}}
  218. {{end}}
  219. {{if eq .MergeStyle "squash"}}
  220. {{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}
  221. {{end}}
  222. </span>
  223. </button>
  224. <div class="ui dropdown icon button">
  225. <i class="dropdown icon"></i>
  226. <div class="menu">
  227. {{if $prUnit.PullRequestsConfig.AllowMerge}}
  228. <div class="item{{if eq .MergeStyle "merge"}} active selected{{end}}" data-do="merge">{{$.i18n.Tr "repo.pulls.merge_pull_request"}}</div>
  229. {{end}}
  230. {{if $prUnit.PullRequestsConfig.AllowRebase}}
  231. <div class="item{{if eq .MergeStyle "rebase"}} active selected{{end}}" data-do="rebase">{{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}</div>
  232. {{end}}
  233. {{if $prUnit.PullRequestsConfig.AllowRebaseMerge}}
  234. <div class="item{{if eq .MergeStyle "rebase-merge"}} active selected{{end}}" data-do="rebase-merge">{{$.i18n.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</div>
  235. {{end}}
  236. {{if $prUnit.PullRequestsConfig.AllowSquash}}
  237. <div class="item{{if eq .MergeStyle "squash"}} active selected{{end}}" data-do="squash">{{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}</div>
  238. {{end}}
  239. </div>
  240. </div>
  241. </div>
  242. {{else}}
  243. <div class="item text red">
  244. <span class="octicon octicon-x"></span>
  245. {{$.i18n.Tr "repo.pulls.no_merge_desc"}}
  246. </div>
  247. <div class="item text grey">
  248. <span class="octicon octicon-info"></span>
  249. {{$.i18n.Tr "repo.pulls.no_merge_helper"}}
  250. </div>
  251. {{end}}
  252. {{end}}
  253. {{end}}
  254. {{else}}
  255. <div class="item text red">
  256. <span class="octicon octicon-x"></span>
  257. {{$.i18n.Tr "repo.pulls.cannot_auto_merge_desc"}}
  258. </div>
  259. <div class="item text grey">
  260. <span class="octicon octicon-info"></span>
  261. {{$.i18n.Tr "repo.pulls.cannot_auto_merge_helper"}}
  262. </div>
  263. {{end}}
  264. </div>
  265. </div>
  266. </div>
上海开阖软件有限公司 沪ICP备12045867号-1