forked from kevadesu/forgejo
feat: Add Search to Releases Page
This commit is contained in:
parent
e5e2860221
commit
86546fe63e
7 changed files with 69 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue