feat: Add Search to Releases Page

This commit is contained in:
JakobDev 2024-11-02 10:24:35 +01:00
parent e5e2860221
commit 86546fe63e
No known key found for this signature in database
GPG key ID: 39DEF62C3ED6DC4C
7 changed files with 69 additions and 3 deletions

View file

@ -168,6 +168,10 @@ func Releases(ctx *context.Context) {
// Disable the showCreateNewBranch form in the dropdown on this page.
ctx.Data["CanCreateBranch"] = false
ctx.Data["HideBranchesInDropdown"] = true
ctx.Data["ShowReleaseSearch"] = true
keyword := ctx.FormTrim("q")
ctx.Data["Keyword"] = keyword
listOptions := db.ListOptions{
Page: ctx.FormInt("page"),
@ -188,6 +192,7 @@ func Releases(ctx *context.Context) {
// only show draft releases for users who can write, read-only users shouldn't see draft releases.
IncludeDrafts: writeAccess,
RepoID: ctx.Repo.Repository.ID,
Keyword: keyword,
})
if err != nil {
ctx.ServerError("getReleaseInfos", err)
@ -258,6 +263,10 @@ func TagsList(ctx *context.Context) {
ctx.Data["CanCreateBranch"] = false
ctx.Data["HideBranchesInDropdown"] = true
ctx.Data["CanCreateRelease"] = ctx.Repo.CanWrite(unit.TypeReleases) && !ctx.Repo.Repository.IsArchived
ctx.Data["ShowReleaseSearch"] = true
keyword := ctx.FormTrim("q")
ctx.Data["Keyword"] = keyword
listOptions := db.ListOptions{
Page: ctx.FormInt("page"),
@ -278,6 +287,7 @@ func TagsList(ctx *context.Context) {
IncludeTags: true,
HasSha1: optional.Some(true),
RepoID: ctx.Repo.Repository.ID,
Keyword: keyword,
}
releases, err := db.Find[repo_model.Release](ctx, opts)