Display tag name as title for a tag with no release

This commit is contained in:
Lunny Xiao 2024-03-02 20:07:23 +08:00 committed by Gergely Nagy
parent 41b4884085
commit c41b2c73ef
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View file

@ -184,6 +184,11 @@ func Releases(ctx *context.Context) {
ctx.ServerError("getReleaseInfos", err) ctx.ServerError("getReleaseInfos", err)
return return
} }
for _, rel := range releases {
if rel.Release.IsTag && rel.Release.Title == "" {
rel.Release.Title = rel.Release.TagName
}
}
ctx.Data["Releases"] = releases ctx.Data["Releases"] = releases
@ -295,6 +300,9 @@ func SingleRelease(ctx *context.Context) {
} }
release := releases[0].Release release := releases[0].Release
if release.IsTag && release.Title == "" {
release.Title = release.TagName
}
ctx.Data["PageIsSingleTag"] = release.IsTag ctx.Data["PageIsSingleTag"] = release.IsTag
if release.IsTag { if release.IsTag {

View file

@ -18,13 +18,13 @@
<div class="ui twelve wide column detail"> <div class="ui twelve wide column detail">
<div class="gt-df gt-ac gt-sb gt-fw gt-mb-3"> <div class="gt-df gt-ac gt-sb gt-fw gt-mb-3">
<h4 class="release-list-title gt-word-break"> <h4 class="release-list-title gt-word-break">
<a href="{{$.RepoLink}}/releases/tag/{{$release.TagName | PathEscapeSegments}}">{{$release.Title}}</a> {{if $.PageIsSingleTag}}{{$release.Title}}{{else}}<a href="{{$.RepoLink}}/releases/tag/{{$release.TagName | PathEscapeSegments}}">{{$release.Title}}</a>{{end}}
{{template "repo/commit_statuses" dict "Status" $info.CommitStatus "Statuses" $info.CommitStatuses "AdditionalClasses" "gt-df"}} {{template "repo/commit_statuses" dict "Status" $info.CommitStatus "Statuses" $info.CommitStatuses "AdditionalClasses" "gt-df"}}
{{if $release.IsDraft}} {{if $release.IsDraft}}
<span class="ui yellow label">{{ctx.Locale.Tr "repo.release.draft"}}</span> <span class="ui yellow label">{{ctx.Locale.Tr "repo.release.draft"}}</span>
{{else if $release.IsPrerelease}} {{else if $release.IsPrerelease}}
<span class="ui orange label">{{ctx.Locale.Tr "repo.release.prerelease"}}</span> <span class="ui orange label">{{ctx.Locale.Tr "repo.release.prerelease"}}</span>
{{else}} {{else if (not $release.IsTag)}}
<span class="ui green label">{{ctx.Locale.Tr "repo.release.stable"}}</span> <span class="ui green label">{{ctx.Locale.Tr "repo.release.stable"}}</span>
{{end}} {{end}}
</h4> </h4>