diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-03-29 21:41:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-29 08:41:45 -0500 |
commit | e57e1144c5ae7a2995e6818c6ae32139e563add7 (patch) | |
tree | eea2b49bef9f1469f99467b5855f74fc28274db4 /templates | |
parent | ed5e7d03c6c44666c6fe97a15e8ce33d223c4466 (diff) | |
download | gitea-e57e1144c5ae7a2995e6818c6ae32139e563add7.tar.gz gitea-e57e1144c5ae7a2995e6818c6ae32139e563add7.zip |
Add ONLY_SHOW_RELEVANT_REPOS back, fix explore page bug, make code more strict (#23766)
Follow #21962
After I eat my own dogfood, I would say that
ONLY_SHOW_RELEVANT_REPOS=false is necessary for many private/enterprise
instances, because many private repositories do not have
"description/topic", users just want to search by their names.
This PR also adds `PageIsExploreRepositories` check, to make code more
strict, because the `search` template is shared for different purpose.
And during the test, I found a bug that the "Search" button didn't
respect the "relevant" parameter, so this PR fixes the bug by the way
together.
I think this PR needs to be backported.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/explore/repo_search.tmpl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/templates/explore/repo_search.tmpl b/templates/explore/repo_search.tmpl index 59d63b19d4..85c1be8e6e 100644 --- a/templates/explore/repo_search.tmpl +++ b/templates/explore/repo_search.tmpl @@ -26,12 +26,15 @@ <input type="hidden" name="language" value="{{$.Language}}"> <div class="ui fluid action input"> <input name="q" value="{{.Keyword}}" placeholder="{{.locale.Tr "explore.search"}}…" autofocus> + {{if .PageIsExploreRepositories}} + <input type="hidden" name="only_show_relevant" value="{{.OnlyShowRelevant}}"> + {{end}} <button class="ui primary button">{{.locale.Tr "explore.search"}}</button> </div> </form> -{{if .OnlyShowRelevant}} +{{if and .PageIsExploreRepositories .OnlyShowRelevant}} <div class="ui message explore-relevancy-note"> - <span data-tooltip-content="{{.locale.Tr "explore.relevant_repositories_tooltip"}}">{{.locale.Tr "explore.relevant_repositories" ((printf "%s%s" $.Link "?no_filter=1")|Escape) | Safe}}</span> + <span data-tooltip-content="{{.locale.Tr "explore.relevant_repositories_tooltip"}}">{{.locale.Tr "explore.relevant_repositories" ((printf "%s%s" $.Link "?only_show_relevant=0")|Escape) | Safe}}</span> </div> {{end}} <div class="ui divider"></div> |