aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-10-23 03:18:15 +0200
committerGitHub <noreply@github.com>2022-10-23 09:18:15 +0800
commit876ee8c3cd956025aadda14175f80ce4cccfe1bb (patch)
treee3108620f171979e0b9606e993317190ec262b49 /routers/web
parent63ebb53fd526021666bd9fab1f9d092380f7a2f4 (diff)
downloadgitea-876ee8c3cd956025aadda14175f80ce4cccfe1bb.tar.gz
gitea-876ee8c3cd956025aadda14175f80ce4cccfe1bb.zip
Allow package version sorting (#21453)
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/user/package.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/routers/web/user/package.go b/routers/web/user/package.go
index c72592e728..7179e2df97 100644
--- a/routers/web/user/package.go
+++ b/routers/web/user/package.go
@@ -233,6 +233,7 @@ func ListPackageVersions(ctx *context.Context) {
}
query := ctx.FormTrim("q")
+ sort := ctx.FormTrim("sort")
ctx.Data["Title"] = ctx.Tr("packages.title")
ctx.Data["IsPackagesPage"] = true
@@ -243,9 +244,11 @@ func ListPackageVersions(ctx *context.Context) {
Owner: ctx.Package.Owner,
}
ctx.Data["Query"] = query
+ ctx.Data["Sort"] = sort
pagerParams := map[string]string{
- "q": query,
+ "q": query,
+ "sort": sort,
}
var (
@@ -264,6 +267,7 @@ func ListPackageVersions(ctx *context.Context) {
PackageID: p.ID,
Query: query,
IsTagged: tagged == "" || tagged == "tagged",
+ Sort: sort,
})
if err != nil {
ctx.ServerError("SearchImageTags", err)
@@ -278,6 +282,7 @@ func ListPackageVersions(ctx *context.Context) {
Value: query,
},
IsInternal: util.OptionalBoolFalse,
+ Sort: sort,
})
if err != nil {
ctx.ServerError("SearchVersions", err)