From aec787b9279399e54e6dd04dc4009addbf93fe89 Mon Sep 17 00:00:00 2001 From: Shiny Nematoda Date: Thu, 11 Apr 2024 14:52:37 +0000 Subject: [PATCH] fix code search template --- routers/web/repo/search.go | 2 +- templates/shared/search/code/results.tmpl | 4 ++-- templates/shared/search/code/search.tmpl | 8 ++------ templates/shared/searchfile.tmpl | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/routers/web/repo/search.go b/routers/web/repo/search.go index 6e7042854..02df17a7e 100644 --- a/routers/web/repo/search.go +++ b/routers/web/repo/search.go @@ -86,7 +86,7 @@ func Search(ctx *context.Context) { } } - ctx.Data["CodeIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled + ctx.Data["CodeIndexerDisabled"] = !setting.Indexer.RepoIndexerEnabled ctx.Data["Repo"] = ctx.Repo.Repository ctx.Data["SourcePath"] = ctx.Repo.Repository.Link() ctx.Data["SearchResults"] = searchResults diff --git a/templates/shared/search/code/results.tmpl b/templates/shared/search/code/results.tmpl index 022192a15..a98a66265 100644 --- a/templates/shared/search/code/results.tmpl +++ b/templates/shared/search/code/results.tmpl @@ -24,10 +24,10 @@ {{else}} {{.Filename}} {{end}} - {{ctx.Locale.Tr "repo.diff.view_file"}} + {{ctx.Locale.Tr "repo.diff.view_file"}}
- {{template "shared/searchfile" dict "RepoLink" $repo.Link "CodeIndexerDisabled" $.CodeIndexerDisabled "SearchResult" .}} + {{template "shared/searchfile" dict "RepoLink" $repo.Link "SearchResult" .}}
{{template "shared/searchbottom" dict "root" $ "result" .}} diff --git a/templates/shared/search/code/search.tmpl b/templates/shared/search/code/search.tmpl index 4a9d905b9..581d1ea38 100644 --- a/templates/shared/search/code/search.tmpl +++ b/templates/shared/search/code/search.tmpl @@ -1,9 +1,5 @@
- {{if not $.CodeIndexerDisabled}} - {{template "shared/search/combo_fuzzy" dict "Value" .Keyword "Disabled" .CodeIndexerUnavailable "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.code_kind")}} - {{else}} - {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.code_kind")}} - {{end}} + {{template "shared/search/combo_fuzzy" dict "Value" .Keyword "Disabled" .CodeIndexerUnavailable "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.code_kind")}}
@@ -12,7 +8,7 @@

{{ctx.Locale.Tr "search.code_search_unavailable"}}

{{else}} - {{if not .CodeIndexerEnabled}} + {{if .CodeIndexerDisabled}}

{{ctx.Locale.Tr "search.code_search_by_git_grep"}}

diff --git a/templates/shared/searchfile.tmpl b/templates/shared/searchfile.tmpl index f2c136955..280584e4d 100644 --- a/templates/shared/searchfile.tmpl +++ b/templates/shared/searchfile.tmpl @@ -4,7 +4,7 @@ {{range .SearchResult.Lines}} - {{.Num}} + {{.Num}} {{.FormattedContent}}