Skip to content

Commit d777053

Browse files
authored
Improve interface when comparing a branch which has created a pull request (#17911)
* Improve interface when comparing a branch which has created a pull request * Take the note back
1 parent 7cc4449 commit d777053

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,7 @@ compare.compare_head = compare
14291429
14301430
pulls.desc = Enable pull requests and code reviews.
14311431
pulls.new = New Pull Request
1432+
pulls.view = View Pull Request
14321433
pulls.compare_changes = New Pull Request
14331434
pulls.compare_changes_desc = Select the branch to merge into and the branch to pull from.
14341435
pulls.compare_base = merge into

routers/web/repo/compare.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,10 @@ func CompareDiff(ctx *context.Context) {
735735
}
736736
} else {
737737
ctx.Data["HasPullRequest"] = true
738+
if err := pr.LoadIssue(); err != nil {
739+
ctx.ServerError("LoadIssue", err)
740+
return
741+
}
738742
ctx.Data["PullRequest"] = pr
739743
ctx.HTML(http.StatusOK, tplCompareDiff)
740744
return

templates/repo/diff/compare.tmpl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,22 @@
187187
{{end}}
188188
{{else if and .PageIsComparePull (gt .CommitCount 0)}}
189189
{{if .HasPullRequest}}
190-
<div class="ui segment">
191-
{{.i18n.Tr "repo.pulls.has_pull_request" (Escape $.RepoLink) (Escape $.RepoRelPath) .PullRequest.Index | Safe}}
190+
<div class="ui segment grid title">
191+
<div class="twelve wide column issue-title">
192+
{{.i18n.Tr "repo.pulls.has_pull_request" (Escape $.RepoLink) (Escape $.RepoRelPath) .PullRequest.Index | Safe}}
193+
<h1>
194+
<span id="issue-title">{{RenderIssueTitle .PullRequest.Issue.Title $.RepoLink $.Repository.ComposeMetas}}</span>
195+
<span class="index">#{{.PullRequest.Issue.Index}}</span>
196+
</h1>
197+
</div>
198+
<div class="four wide right middle aligned column">
199+
{{- if .PullRequest.HasMerged -}}
200+
<a href="{{Escape $.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button purple show-form">{{svg "octicon-git-merge" 16}} {{.i18n.Tr "repo.pulls.view"}}</a>
201+
{{else if .Issue.IsClosed}}
202+
<a href="{{Escape $.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button red show-form">{{svg "octicon-issue-closed" 16}} {{.i18n.Tr "repo.pulls.view"}}</a>
203+
{{else}}
204+
<a href="{{Escape $.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button green show-form">{{svg "octicon-git-pull-request" 16}} {{.i18n.Tr "repo.pulls.view"}}</a>
205+
{{end}}</div>
192206
</div>
193207
{{else}}
194208
{{if and $.IsSigned (not .Repository.IsArchived)}}

web_src/less/_repository.less

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,15 @@
12981298
.markup {
12991299
font-size: 14px;
13001300
}
1301+
1302+
.title {
1303+
.issue-title {
1304+
margin-bottom: .5rem;
1305+
.index {
1306+
color: var(--color-text-light-2);
1307+
}
1308+
}
1309+
}
13011310
}
13021311

13031312
.filter.dropdown .menu {

0 commit comments

Comments
 (0)