-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update button is shown when a Pull Request is marked WIP - Issue #21740…
… (#22683) Fix #21740. Updated the Pull Request template so that the 'Update branch by merge' button is visible for WIP PR's. Making the behaviour match a non WIP-PR. Previous WIP page with changes pending on the branch: ![image](https://user-images.githubusercontent.com/1656302/215738307-e68a2f92-5ff8-4f48-a541-35ca81d1f1a4.png) Updated UI adding the update button: ![image](https://user-images.githubusercontent.com/1656302/215737872-e0e9d712-b7aa-4b90-b7ed-6a92a14fc182.png) ## Notes * have not removed the **$canAutoMerge** variable from the pull.tmpl on this [line](https://github.com/go-gitea/gitea/blob/36dc11869d0401b796a7a3f74627fec842a4a89a/templates/repo/issue/view_content/pull.tmpl#L131) - doesn't appear to be used elsewhere but wasn't sure * In order to avoid duplicating code corresponding UI code was added to a new tmpl file, ```update_branch_by_merge.tmpl``` and is called in two places from ```pull.tmpl```. --------- Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
- Loading branch information
1 parent
82728a7
commit 8913916
Showing
2 changed files
with
41 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
templates/repo/issue/view_content/update_branch_by_merge.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{{$canAutoMerge := false}} | ||
{{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}} | ||
<div class="ui divider"></div> | ||
<div class="item item-section"> | ||
<div class="item-section-left"> | ||
<i class="icon icon-octicon">{{svg "octicon-alert"}}</i> | ||
{{$.locale.Tr "repo.pulls.outdated_with_base_branch"}} | ||
</div> | ||
<div class="item-section-right"> | ||
{{if and .UpdateAllowed .UpdateByRebaseAllowed}} | ||
<div class="dib"> | ||
<div class="ui buttons update-button"> | ||
<button class="ui button" data-do="{{.Link}}/update" data-redirect="{{.Link}}"> | ||
<span class="button-text"> | ||
{{$.locale.Tr "repo.pulls.update_branch"}} | ||
</span> | ||
</button> | ||
|
||
<div class="ui dropdown icon button no-text"> | ||
{{svg "octicon-triangle-down" 14 "dropdown icon"}} | ||
<div class="menu"> | ||
<div class="item active selected" data-do="{{.Link}}/update">{{$.locale.Tr "repo.pulls.update_branch"}}</div> | ||
<div class="item" data-do="{{.Link}}/update?style=rebase">{{$.locale.Tr "repo.pulls.update_branch_rebase"}}</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{{end}} | ||
{{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}} | ||
<form action="{{.Link}}/update" method="post" class="ui update-branch-form"> | ||
{{.CsrfTokenHtml}} | ||
<button class="ui compact button" data-do="update"> | ||
<span class="ui text">{{$.locale.Tr "repo.pulls.update_branch"}}</span> | ||
</button> | ||
</form> | ||
{{end}} | ||
</div> | ||
</div> | ||
{{end}} |