summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorJimmy Praet <jimmy.praet@telenet.be>2021-02-18 03:45:49 +0100
committerGitHub <noreply@github.com>2021-02-18 03:45:49 +0100
commit4c82485424adb0fcf72cf9cde74596a7f0f54ada (patch)
tree97554f86469f5a6e7f6fd2f79f668a8ba7749e16 /templates
parent7ab6c77b4120d96b3239f827da8b858f65c36863 (diff)
downloadgitea-4c82485424adb0fcf72cf9cde74596a7f0f54ada.tar.gz
gitea-4c82485424adb0fcf72cf9cde74596a7f0f54ada.zip
#14699 Make branch names in PR description clickable (#14716)
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/issue/view_title.tmpl20
1 files changed, 14 insertions, 6 deletions
diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl
index 8956bf5e65..2f2787d67c 100644
--- a/templates/repo/issue/view_title.tmpl
+++ b/templates/repo/issue/view_title.tmpl
@@ -30,23 +30,31 @@
{{end}}
{{if .Issue.IsPull}}
+ {{$headHref := .HeadTarget|Escape}}
+ {{if .HeadBranchHTMLURL}}
+ {{$headHref = printf "<a href=\"%s\">%s</a>" .HeadBranchHTMLURL $headHref}}
+ {{end}}
+ {{$baseHref := .BaseTarget|Escape}}
+ {{if .BaseBranchHTMLURL}}
+ {{$baseHref = printf "<a href=\"%s\">%s</a>" .BaseBranchHTMLURL $baseHref}}
+ {{end}}
{{if .Issue.PullRequest.HasMerged}}
{{ $mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix $.Lang }}
{{if .Issue.OriginalAuthor }}
{{.Issue.OriginalAuthor}}
- <span class="pull-desc">{{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits (.HeadTarget|Escape) (.BaseTarget|Escape) $mergedStr | Str2html}}</span>
+ <span class="pull-desc">{{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Str2html}}</span>
{{else}}
<a {{if gt .Issue.PullRequest.Merger.ID 0}}href="{{.Issue.PullRequest.Merger.HomeLink}}"{{end}}>{{.Issue.PullRequest.Merger.GetDisplayName}}</a>
- <span class="pull-desc">{{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits (.HeadTarget|Escape) (.BaseTarget|Escape) $mergedStr | Str2html}}</span>
+ <span class="pull-desc">{{$.i18n.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Str2html}}</span>
{{end}}
{{else}}
{{if .Issue.OriginalAuthor }}
- <span id="pull-desc" class="pull-desc">{{.Issue.OriginalAuthor}} {{$.i18n.Tr "repo.pulls.title_desc" .NumCommits (.HeadTarget|Escape) (.BaseTarget|Escape) | Str2html}}</span>
+ <span id="pull-desc" class="pull-desc">{{.Issue.OriginalAuthor}} {{$.i18n.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Str2html}}</span>
{{else}}
<span id="pull-desc" class="pull-desc">
- <a {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a>
- {{$.i18n.Tr "repo.pulls.title_desc" .NumCommits (.HeadTarget|Escape) (.BaseTarget|Escape) | Str2html}}
- </span>
+ <a {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a>
+ {{$.i18n.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Str2html}}
+ </span>
{{end}}
<span id="pull-desc-edit" style="display: none">
<div class="ui floating filter dropdown">