diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 12dcd6e017..d09ea26942 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1068,6 +1068,7 @@ release = Release releases = Releases tag = Tag released_this = released this +tagged_this = tagged this file.title = %s at %s file_raw = Raw file_history = History @@ -2287,6 +2288,7 @@ release.compare = Compare release.edit = edit release.ahead.commits = %d commits release.ahead.target = to %s since this release +tag.ahead.target = to %s since this tag release.source_code = Source Code release.new_subheader = Releases organize project versions. release.edit_subheader = Releases organize project versions. diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go index e969fdc5ab..3ffadd34ac 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -226,8 +226,8 @@ func releasesOrTagsFeed(ctx *context.Context, isReleasesOnly bool, formatType st // SingleRelease renders a single release's page func SingleRelease(ctx *context.Context) { - ctx.Data["Title"] = ctx.Tr("repo.release.releases") ctx.Data["PageIsReleaseList"] = true + ctx.Data["DefaultBranch"] = ctx.Repo.Repository.DefaultBranch writeAccess := ctx.Repo.CanWrite(unit.TypeReleases) ctx.Data["CanCreateRelease"] = writeAccess && !ctx.Repo.Repository.IsArchived @@ -241,6 +241,12 @@ func SingleRelease(ctx *context.Context) { ctx.ServerError("GetReleasesByRepoID", err) return } + ctx.Data["PageIsSingleTag"] = release.IsTag + if release.IsTag { + ctx.Data["Title"] = release.TagName + } else { + ctx.Data["Title"] = release.Title + } err = repo_model.GetReleaseAttachments(ctx, release) if err != nil { diff --git a/services/repository/push.go b/services/repository/push.go index 4b574e3440..7f174c71b3 100644 --- a/services/repository/push.go +++ b/services/repository/push.go @@ -374,15 +374,20 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo rel, has := relMap[lowerTag] if !has { + parts := strings.SplitN(tag.Message, "\n", 2) + note := "" + if len(parts) > 1 { + note = parts[1] + } rel = &repo_model.Release{ RepoID: repo.ID, - Title: "", + Title: parts[0], TagName: tags[i], LowerTagName: lowerTag, Target: "", Sha1: commit.ID.String(), NumCommits: commitsCount, - Note: "", + Note: note, IsDraft: false, IsPrerelease: false, IsTag: true, diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index 8b320a956c..5e5716fa57 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -5,10 +5,10 @@ {{template "base/alert" .}}
- {{if gt .Publisher.ID 0}} - - {{$.locale.Tr "repo.released_this"}} - - {{if .CreatedUnix}} - {{TimeSinceUnix .CreatedUnix $.locale}} - {{end}} - | - {{end}} - {{$.locale.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}} {{$.locale.Tr "repo.release.ahead.target" $.DefaultBranch}} -
- -+ {{if gt .Publisher.ID 0}} + + {{$.locale.Tr "repo.tagged_this"}} + + {{if .CreatedUnix}} + {{TimeSinceUnix .CreatedUnix $.locale}} + {{end}} + | + {{end}} + {{$.locale.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}} {{$.locale.Tr "repo.tag.ahead.target" $.DefaultBranch}} +
+ {{else}} ++ {{end}}