summaryrefslogtreecommitdiffstats
path: root/routers/home.go
diff options
context:
space:
mode:
authorMorlinest <Morlinest@users.noreply.github.com>2017-09-22 14:53:21 +0200
committerLauris BH <lauris@nix.lv>2017-09-22 15:53:21 +0300
commit9a75a5d59bcf9aaff596a7df36ab3aa5b46477a8 (patch)
treea1a7d87e89387ba3c76313f81fc95d252bbc178a /routers/home.go
parentca68a75b5b8d457f56905ebb7e56d4b7c4566c2e (diff)
downloadgitea-9a75a5d59bcf9aaff596a7df36ab3aa5b46477a8.tar.gz
gitea-9a75a5d59bcf9aaff596a7df36ab3aa5b46477a8.zip
Use custom type and constants to hold order by options (#2572)
Diffstat (limited to 'routers/home.go')
-rw-r--r--routers/home.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/routers/home.go b/routers/home.go
index 16d0720551..381bdd20ae 100644
--- a/routers/home.go
+++ b/routers/home.go
@@ -86,27 +86,27 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
repos []*models.Repository
count int64
err error
- orderBy string
+ orderBy models.SearchOrderBy
)
ctx.Data["SortType"] = ctx.Query("sort")
switch ctx.Query("sort") {
case "oldest":
- orderBy = "created_unix ASC"
+ orderBy = models.SearchOrderByOldest
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
case "reversesize":
- orderBy = "size DESC"
+ orderBy = models.SearchOrderBySizeReverse
case "size":
- orderBy = "size ASC"
+ orderBy = models.SearchOrderBySize
default:
- orderBy = "created_unix DESC"
+ orderBy = models.SearchOrderByNewest
}
keyword := strings.Trim(ctx.Query("q"), " ")