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.

148 lines
5.8 KiB

  1. <div class="comment merge box">
  2. <a class="avatar text
  3. {{if .Issue.PullRequest.HasMerged}}purple
  4. {{else if .Issue.IsClosed}}grey
  5. {{else if .IsPullReuqestBroken}}red
  6. {{else if .Issue.PullRequest.IsChecking}}yellow
  7. {{else if .Issue.PullRequest.CanAutoMerge}}green
  8. {{else}}red{{end}}"><span class="mega-octicon octicon-git-merge"></span></a>
  9. <div class="content">
  10. <div class="ui merge segment">
  11. {{if .Issue.PullRequest.HasMerged}}
  12. <div class="item text purple">
  13. {{$.i18n.Tr "repo.pulls.has_merged"}}
  14. </div>
  15. {{if .IsPullBranchDeletable}}
  16. <div class="ui divider"></div>
  17. <div>
  18. <a class="delete-button ui red button" href="" data-url="{{.DeleteBranchLink}}">{{$.i18n.Tr "repo.branch.delete" .HeadTarget}}</a>
  19. </div>
  20. {{end}}
  21. {{else if .Issue.IsClosed}}
  22. <div class="item text grey">
  23. {{$.i18n.Tr "repo.pulls.reopen_to_merge"}}
  24. </div>
  25. {{else if .IsPullReuqestBroken}}
  26. <div class="item text red">
  27. <span class="octicon octicon-x"></span>
  28. {{$.i18n.Tr "repo.pulls.data_broken"}}
  29. </div>
  30. {{else if .Issue.PullRequest.IsChecking}}
  31. <div class="item text yellow">
  32. <span class="octicon octicon-sync"></span>
  33. {{$.i18n.Tr "repo.pulls.is_checking"}}
  34. </div>
  35. {{else if .Issue.PullRequest.CanAutoMerge}}
  36. <div class="item text green">
  37. <span class="octicon octicon-check"></span>
  38. {{$.i18n.Tr "repo.pulls.can_auto_merge_desc"}}
  39. </div>
  40. {{if .IsRepositoryWriter}}
  41. {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}}
  42. {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowSquash}}
  43. <div class="ui divider"></div>
  44. {{if $prUnit.PullRequestsConfig.AllowMerge}}
  45. <div class="ui form merge-fields" style="display: none">
  46. <form action="{{.Link}}/merge" method="post">
  47. {{.CsrfTokenHtml}}
  48. <div class="field">
  49. <input type="text" name="merge_title_field" value="{{.Issue.PullRequest.GetDefaultMergeMessage}}">
  50. </div>
  51. <div class="field">
  52. <textarea name="merge_message_field" rows="5" placeholder="{{$.i18n.Tr "repo.editor.commit_message_desc"}}"></textarea>
  53. </div>
  54. <button class="ui green button" type="submit" name="do" value="merge">
  55. {{$.i18n.Tr "repo.pulls.merge_pull_request"}}
  56. </button>
  57. <button class="ui button merge-cancel">
  58. {{$.i18n.Tr "cancel"}}
  59. </button>
  60. </form>
  61. </div>
  62. {{end}}
  63. {{if $prUnit.PullRequestsConfig.AllowRebase}}
  64. <div class="ui form rebase-fields" style="display: none">
  65. <form action="{{.Link}}/merge" method="post">
  66. {{.CsrfTokenHtml}}
  67. <button class="ui green button" type="submit" name="do" value="rebase">
  68. {{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}
  69. </button>
  70. <button class="ui button merge-cancel">
  71. {{$.i18n.Tr "cancel"}}
  72. </button>
  73. </form>
  74. </div>
  75. {{end}}
  76. {{if $prUnit.PullRequestsConfig.AllowSquash}}
  77. <div class="ui form squash-fields" style="display: none">
  78. <form action="{{.Link}}/merge" method="post">
  79. {{.CsrfTokenHtml}}
  80. <div class="field">
  81. <input type="text" name="merge_title_field" value="{{.Issue.PullRequest.GetDefaultSquashMessage}}">
  82. </div>
  83. <div class="field">
  84. <textarea name="merge_message_field" rows="5" placeholder="{{$.i18n.Tr "repo.editor.commit_message_desc"}}"></textarea>
  85. </div>
  86. <button class="ui green button" type="submit" name="do" value="squash">
  87. {{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}
  88. </button>
  89. <button class="ui button merge-cancel">
  90. {{$.i18n.Tr "cancel"}}
  91. </button>
  92. </form>
  93. </div>
  94. {{end}}
  95. <div class="ui green buttons merge-button">
  96. <button class="ui button" data-do="{{.MergeStyle}}">
  97. <span class="octicon octicon-git-merge"></span>
  98. <span class="button-text">
  99. {{if eq .MergeStyle "merge"}}
  100. {{$.i18n.Tr "repo.pulls.merge_pull_request"}}
  101. {{end}}
  102. {{if eq .MergeStyle "rebase"}}
  103. {{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}
  104. {{end}}
  105. {{if eq .MergeStyle "squash"}}
  106. {{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}
  107. {{end}}
  108. </span>
  109. </button>
  110. <div class="ui dropdown icon button">
  111. <i class="dropdown icon"></i>
  112. <div class="menu">
  113. {{if $prUnit.PullRequestsConfig.AllowMerge}}
  114. <div class="item{{if eq .MergeStyle "merge"}} active selected{{end}}" data-do="merge">{{$.i18n.Tr "repo.pulls.merge_pull_request"}}</div>
  115. {{end}}
  116. {{if $prUnit.PullRequestsConfig.AllowRebase}}
  117. <div class="item{{if eq .MergeStyle "rebase"}} active selected{{end}}" data-do="rebase">{{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}</div>
  118. {{end}}
  119. {{if $prUnit.PullRequestsConfig.AllowSquash}}
  120. <div class="item{{if eq .MergeStyle "squash"}} active selected{{end}}" data-do="squash">{{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}</div>
  121. {{end}}
  122. </div>
  123. </div>
  124. </div>
  125. {{else}}
  126. <div class="item text red">
  127. <span class="octicon octicon-x"></span>
  128. {{$.i18n.Tr "repo.pulls.no_merge_desc"}}
  129. </div>
  130. <div class="item text grey">
  131. <span class="octicon octicon-info"></span>
  132. {{$.i18n.Tr "repo.pulls.no_merge_helper"}}
  133. </div>
  134. {{end}}
  135. {{end}}
  136. {{else}}
  137. <div class="item text red">
  138. <span class="octicon octicon-x"></span>
  139. {{$.i18n.Tr "repo.pulls.cannot_auto_merge_desc"}}
  140. </div>
  141. <div class="item text grey">
  142. <span class="octicon octicon-info"></span>
  143. {{$.i18n.Tr "repo.pulls.cannot_auto_merge_helper"}}
  144. </div>
  145. {{end}}
  146. </div>
  147. </div>
  148. </div>