summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/home.go24
-rw-r--r--routers/user/profile.go8
2 files changed, 24 insertions, 8 deletions
diff --git a/routers/home.go b/routers/home.go
index 4810eb4e6f..5bb353c7e1 100644
--- a/routers/home.go
+++ b/routers/home.go
@@ -104,6 +104,14 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
orderBy = models.SearchOrderBySizeReverse
case "size":
orderBy = models.SearchOrderBySize
+ case "moststars":
+ orderBy = models.SearchOrderByStarsReverse
+ case "feweststars":
+ orderBy = models.SearchOrderByStars
+ case "mostforks":
+ orderBy = models.SearchOrderByForksReverse
+ case "fewestforks":
+ orderBy = models.SearchOrderByForks
default:
ctx.Data["SortType"] = "recentupdate"
orderBy = models.SearchOrderByRecentUpdated
@@ -164,26 +172,26 @@ func RenderUserSearch(ctx *context.Context, opts *models.SearchUserOptions, tplN
users []*models.User
count int64
err error
- orderBy string
+ orderBy models.SearchOrderBy
)
ctx.Data["SortType"] = ctx.Query("sort")
switch ctx.Query("sort") {
case "newest":
- orderBy = "id DESC"
+ orderBy = models.SearchOrderByIDReverse
case "oldest":
- orderBy = "id ASC"
+ orderBy = models.SearchOrderByID
case "recentupdate":
- orderBy = "updated_unix DESC"
+ orderBy = models.SearchOrderByRecentUpdated
case "leastupdate":
- orderBy = "updated_unix ASC"
+ orderBy = models.SearchOrderByLeastUpdated
case "reversealphabetically":
- orderBy = "name DESC"
+ orderBy = models.SearchOrderByAlphabeticallyReverse
case "alphabetically":
- orderBy = "name ASC"
+ orderBy = models.SearchOrderByAlphabetically
default:
ctx.Data["SortType"] = "alphabetically"
- orderBy = "name ASC"
+ orderBy = models.SearchOrderByAlphabetically
}
opts.Keyword = strings.Trim(ctx.Query("q"), " ")
diff --git a/routers/user/profile.go b/routers/user/profile.go
index 6f8b8fe897..fb731e715c 100644
--- a/routers/user/profile.go
+++ b/routers/user/profile.go
@@ -125,6 +125,14 @@ func Profile(ctx *context.Context) {
orderBy = models.SearchOrderByAlphabeticallyReverse
case "alphabetically":
orderBy = models.SearchOrderByAlphabetically
+ case "moststars":
+ orderBy = models.SearchOrderByStarsReverse
+ case "feweststars":
+ orderBy = models.SearchOrderByStars
+ case "mostforks":
+ orderBy = models.SearchOrderByForksReverse
+ case "fewestforks":
+ orderBy = models.SearchOrderByForks
default:
ctx.Data["SortType"] = "recentupdate"
orderBy = models.SearchOrderByRecentUpdated