Skip to content

Commit 89caf08

Browse files
author
Gusted
committed
Show information message to indicate filtered results
- When the explore results are filtered(so no user query + default sorting), show a information message to indicate it has been filtered. Also offer users a easy way to unfilter the results.
1 parent 1dc8fde commit 89caf08

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

options/locale/locale_en-US.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ org_no_results = No matching organizations found.
275275
code_no_results = No source code matching your search term found.
276276
code_search_results = Search results for '%s'
277277
code_last_indexed_at = Last indexed %s
278+
relevant_repositories_tooltip = Repositories that are forks or don't have a topic and description aren't being shown.
279+
relevant_repositories = Only relevant repositories are being shown, <a href="%s">show unfiltered results</a>.
280+
278281

279282
[auth]
280283
create_new_account = Register Account

routers/web/explore/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
7373
default:
7474
ctx.Data["SortType"] = "recentupdate"
7575
orderBy = db.SearchOrderByRecentUpdated
76-
onlyShowRelevant = true
76+
onlyShowRelevant = !ctx.FormBool("no_filter")
7777
}
7878

7979
keyword := ctx.FormTrim("q")

templates/explore/repo_search.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@
3030
<button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
3131
</div>
3232
</form>
33+
{{if .OnlyShowRelevant}}
34+
<div class="ui blue attached message" style="max-width: 90%; margin-top: 0; border-top: 0">
35+
<span class="ui tooltip" data-content="{{.i18n.Tr "explore.relevant_repositories_tooltip"}}">{{.i18n.Tr "explore.relevant_repositories" ((printf "%s%s" $.Link "?no_filter=1")|Escape) | Safe}}</span>
36+
</div>
37+
{{end}}
3338
<div class="ui divider"></div>

0 commit comments

Comments
 (0)