From 4a061ca26c9fc9f36822fa9e34fb9f0121af4e7c Mon Sep 17 00:00:00 2001 From: Shiny Nematoda Date: Wed, 20 Mar 2024 12:22:43 +0000 Subject: [PATCH] simplify template --- routers/web/repo/search.go | 4 ++-- templates/shared/search/code/results.tmpl | 4 ++-- templates/shared/search/code/search.tmpl | 2 +- templates/shared/searchfile.tmpl | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/routers/web/repo/search.go b/routers/web/repo/search.go index 273b90c97..460378ce0 100644 --- a/routers/web/repo/search.go +++ b/routers/web/repo/search.go @@ -41,7 +41,7 @@ func Search(ctx *context.Context) { } if setting.Indexer.RepoIndexerEnabled { - ctx.Data["CodeIndexerEnabled"] = true + ctx.Data["CodeIndexerDisabled"] = false total, searchResults, searchResultLanguages, err := code_indexer.PerformSearch(ctx, &code_indexer.SearchOptions{ RepoIDs: []int64{ctx.Repo.Repository.ID}, @@ -77,7 +77,7 @@ func Search(ctx *context.Context) { return } - ctx.Data["CodeIndexerEnabled"] = false + ctx.Data["CodeIndexerDisabled"] = true ctx.Data["SearchResults"] = data pager := context.NewPagination(len(data), setting.UI.RepoSearchPagingNum, page, 5) diff --git a/templates/shared/search/code/results.tmpl b/templates/shared/search/code/results.tmpl index 09604e0f6..02d125277 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 "CodeIndexerEnabled" $.CodeIndexerEnabled "SearchResult" .}} + {{template "shared/searchfile" dict "RepoLink" $repo.Link "CodeIndexerDisabled" $.CodeIndexerDisabled "SearchResult" .}}
{{template "shared/searchbottom" dict "root" $ "result" .}} diff --git a/templates/shared/search/code/search.tmpl b/templates/shared/search/code/search.tmpl index 4b1257bed..0cfd62a1f 100644 --- a/templates/shared/search/code/search.tmpl +++ b/templates/shared/search/code/search.tmpl @@ -1,5 +1,5 @@
- {{if ne $.CodeIndexerEnabled false}} + {{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")}} diff --git a/templates/shared/searchfile.tmpl b/templates/shared/searchfile.tmpl index 4c098138d..f2c136955 100644 --- a/templates/shared/searchfile.tmpl +++ b/templates/shared/searchfile.tmpl @@ -4,7 +4,7 @@ {{range .SearchResult.Lines}} - {{.Num}} + {{.Num}} {{.FormattedContent}}