From 20d0522e98121905cf9e5fcfd9a4cd4e78f8eab2 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Tue, 26 Apr 2022 17:08:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/repo_list.go | 1 + routers/home.go | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/models/repo_list.go b/models/repo_list.go index 5bf0ecf03..253cc968c 100755 --- a/models/repo_list.go +++ b/models/repo_list.go @@ -221,6 +221,7 @@ const ( SearchOrderByHot SearchOrderBy = "(num_watches + num_stars + num_forks + clone_cnt) DESC" SearchOrderByActive SearchOrderBy = "(num_issues + num_pulls + num_commit) DESC" SearchOrderByWatches SearchOrderBy = "num_watches DESC" + SearchOrderByDefault SearchOrderBy = "recommend desc,num_stars DESC,updated_unix DESC" ) // SearchRepositoryCondition creates a query condition according search repository options diff --git a/routers/home.go b/routers/home.go index 5dec05ebe..500ffbbd6 100755 --- a/routers/home.go +++ b/routers/home.go @@ -309,9 +309,11 @@ func ExploreDatasets(ctx *context.Context) { orderBy = models.SearchOrderByStarsReverse case "feweststars": orderBy = models.SearchOrderByStars + case "default": + orderBy = models.SearchOrderByDefault default: - ctx.Data["SortType"] = "recentupdate" - orderBy = models.SearchOrderByRecentUpdated + ctx.Data["SortType"] = "default" + orderBy = models.SearchOrderByDefault } keyword := strings.Trim(ctx.Query("q"), " ") From cc6ab81e719c42f1c44b419efd5af4c39ec5a549 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 27 Apr 2022 09:40:35 +0800 Subject: [PATCH 2/2] fix issue --- options/locale/locale_en-US.ini | 1 + options/locale/locale_zh-CN.ini | 1 + templates/explore/datasets.tmpl | 3 +++ 3 files changed, 5 insertions(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 1ae488026..ca16093a6 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1392,6 +1392,7 @@ issues.filter_type.assigned_to_you = Assigned to you issues.filter_type.created_by_you = Created by you issues.filter_type.mentioning_you = Mentioning you issues.filter_sort = Sort +issues.filter_sort.default = Default issues.filter_sort.latest = Newest issues.filter_sort.oldest = Oldest issues.filter_sort.recentupdate = Recently updated diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 95e36c602..041354f9d 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1404,6 +1404,7 @@ issues.filter_type.assigned_to_you=指派给您的 issues.filter_type.created_by_you=由您创建的 issues.filter_type.mentioning_you=提及您的 issues.filter_sort=排序 +issues.filter_sort.default=默认排序 issues.filter_sort.latest=最新创建 issues.filter_sort.oldest=最早创建 issues.filter_sort.recentupdate=最近更新 diff --git a/templates/explore/datasets.tmpl b/templates/explore/datasets.tmpl index 7b2577900..854da4fff 100644 --- a/templates/explore/datasets.tmpl +++ b/templates/explore/datasets.tmpl @@ -121,6 +121,7 @@