mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Included tag search capabilities (#32045)
Resolves #31998 The first screenshot shows the tag page without any filter being applied:  The second one, shows the page when the given filter returns no tag:  The last one shows a single tag being filtered:  Signed-off-by: Bruno Sofiato <bruno.sofiato@gmail.com>
This commit is contained in:
@@ -214,6 +214,8 @@ func TagsList(ctx *context.Context) {
|
||||
ctx.Data["HideBranchesInDropdown"] = true
|
||||
ctx.Data["CanCreateRelease"] = ctx.Repo.CanWrite(unit.TypeReleases) && !ctx.Repo.Repository.IsArchived
|
||||
|
||||
namePattern := ctx.FormTrim("q")
|
||||
|
||||
listOptions := db.ListOptions{
|
||||
Page: ctx.FormInt("page"),
|
||||
PageSize: ctx.FormInt("limit"),
|
||||
@@ -233,6 +235,7 @@ func TagsList(ctx *context.Context) {
|
||||
IncludeTags: true,
|
||||
HasSha1: optional.Some(true),
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
NamePattern: optional.Some(namePattern),
|
||||
}
|
||||
|
||||
releases, err := db.Find[repo_model.Release](ctx, opts)
|
||||
@@ -241,14 +244,21 @@ func TagsList(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["Releases"] = releases
|
||||
count, err := db.Count[repo_model.Release](ctx, opts)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetReleasesByRepoID", err)
|
||||
return
|
||||
}
|
||||
|
||||
numTags := ctx.Data["NumTags"].(int64)
|
||||
pager := context.NewPagination(int(numTags), opts.PageSize, opts.Page, 5)
|
||||
ctx.Data["Keyword"] = namePattern
|
||||
ctx.Data["Releases"] = releases
|
||||
ctx.Data["TagCount"] = count
|
||||
|
||||
pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.Data["PageIsViewCode"] = !ctx.Repo.Repository.UnitEnabled(ctx, unit.TypeReleases)
|
||||
|
||||
ctx.HTML(http.StatusOK, tplTagsList)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user