Merge pull request '[UI] Revert "Remove ONLY_SHOW_RELEVANT_REPOS setting"' (#456) from earl-warren/forgejo:wip-relevant into forgejo-development
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/456
This commit is contained in:
commit
162560d26e
1 changed files with 6 additions and 3 deletions
|
@ -18,7 +18,6 @@ import (
|
||||||
const (
|
const (
|
||||||
// tplExploreRepos explore repositories page template
|
// tplExploreRepos explore repositories page template
|
||||||
tplExploreRepos base.TplName = "explore/repos"
|
tplExploreRepos base.TplName = "explore/repos"
|
||||||
relevantReposOnlyParam string = "no_filter"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// RepoSearchOptions when calling search repositories
|
// RepoSearchOptions when calling search repositories
|
||||||
|
@ -84,9 +83,13 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
|
||||||
default:
|
default:
|
||||||
ctx.Data["SortType"] = "recentupdate"
|
ctx.Data["SortType"] = "recentupdate"
|
||||||
orderBy = db.SearchOrderByRecentUpdated
|
orderBy = db.SearchOrderByRecentUpdated
|
||||||
|
onlyShowRelevant = setting.UI.OnlyShowRelevantRepos && !ctx.FormBool("no_filter")
|
||||||
}
|
}
|
||||||
|
|
||||||
keyword := ctx.FormTrim("q")
|
keyword := ctx.FormTrim("q")
|
||||||
|
if keyword != "" {
|
||||||
|
onlyShowRelevant = false
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Data["OnlyShowRelevant"] = opts.OnlyShowRelevant
|
ctx.Data["OnlyShowRelevant"] = opts.OnlyShowRelevant
|
||||||
|
|
||||||
|
@ -138,7 +141,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
|
||||||
pager.SetDefaultParams(ctx)
|
pager.SetDefaultParams(ctx)
|
||||||
pager.AddParam(ctx, "topic", "TopicOnly")
|
pager.AddParam(ctx, "topic", "TopicOnly")
|
||||||
pager.AddParam(ctx, "language", "Language")
|
pager.AddParam(ctx, "language", "Language")
|
||||||
pager.AddParamString(relevantReposOnlyParam, ctx.FormString(relevantReposOnlyParam))
|
pager.AddParamString("no_filter", ctx.FormString("no_filter"))
|
||||||
ctx.Data["Page"] = pager
|
ctx.Data["Page"] = pager
|
||||||
|
|
||||||
ctx.HTML(http.StatusOK, opts.TplName)
|
ctx.HTML(http.StatusOK, opts.TplName)
|
||||||
|
|
Loading…
Reference in a new issue