Skip to content

Commit 72b2ff1

Browse files
committed
add download links to raw diff and patch in diff box options dropdown
1 parent c98fccf commit 72b2ff1

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

routers/web/repo/compare.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,7 @@ func CompareDiff(ctx *context.Context) {
750750
return
751751
}
752752

753+
ctx.Data["PageIsCompareDiff"] = true
753754
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
754755
ctx.Data["DirectComparison"] = ci.DirectComparison
755756
ctx.Data["OtherCompareSeparator"] = ".."

templates/repo/diff/options_dropdown.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
{{else if .Commit.ID.String}}
1111
<a class="item" href="{{$.RepoLink}}/commit/{{PathEscape .Commit.ID.String}}.patch" download="{{ShortSha .Commit.ID.String}}.patch">{{ctx.Locale.Tr "repo.diff.download_patch"}}</a>
1212
<a class="item" href="{{$.RepoLink}}/commit/{{PathEscape .Commit.ID.String}}.diff" download="{{ShortSha .Commit.ID.String}}.diff">{{ctx.Locale.Tr "repo.diff.download_diff"}}</a>
13+
{{else if $.PageIsCompareDiff }}
14+
<a class="item" href="{{$.Link}}.patch" download="{{$.BaseBranch}}...{{$.HeadBranch}}.patch">{{ctx.Locale.Tr "repo.diff.download_patch"}}</a>
15+
<a class="item" href="{{$.Link}}.diff" download="{{$.BaseBranch}}...{{$.HeadBranch}}.diff">{{ctx.Locale.Tr "repo.diff.download_diff"}}</a>
1316
{{end}}
1417
<a id="expand-files-btn" class="item">{{ctx.Locale.Tr "repo.pulls.expand_files"}}</a>
1518
<a id="collapse-files-btn" class="item">{{ctx.Locale.Tr "repo.pulls.collapse_files"}}</a>

0 commit comments

Comments
 (0)