From a98cf0e68ed0da866688580ef26557f9211d1c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= Date: Tue, 27 Aug 2024 17:23:02 +0200 Subject: [PATCH] code-search: make linters happy again --- routers/web/explore/code.go | 4 +--- routers/web/user/code.go | 4 +--- templates/shared/search/combo_multi.tmpl | 26 ++++++++++++------------ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/routers/web/explore/code.go b/routers/web/explore/code.go index 7a3f6a5a86..437282cbb1 100644 --- a/routers/web/explore/code.go +++ b/routers/web/explore/code.go @@ -35,11 +35,9 @@ func Code(ctx *context.Context) { language := ctx.FormTrim("l") keyword := ctx.FormTrim("q") - isFuzzy := true + isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true) if mode := ctx.FormTrim("mode"); len(mode) > 0 { isFuzzy = mode == "fuzzy" - } else { - isFuzzy = ctx.FormOptionalBool("fuzzy").ValueOrDefault(true) } ctx.Data["Keyword"] = keyword diff --git a/routers/web/user/code.go b/routers/web/user/code.go index bf4cbb8920..26e48d1ea6 100644 --- a/routers/web/user/code.go +++ b/routers/web/user/code.go @@ -40,11 +40,9 @@ func CodeSearch(ctx *context.Context) { language := ctx.FormTrim("l") keyword := ctx.FormTrim("q") - isFuzzy := true + isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true) if mode := ctx.FormTrim("mode"); len(mode) > 0 { isFuzzy = mode == "fuzzy" - } else { - isFuzzy = ctx.FormOptionalBool("fuzzy").ValueOrDefault(true) } ctx.Data["Keyword"] = keyword diff --git a/templates/shared/search/combo_multi.tmpl b/templates/shared/search/combo_multi.tmpl index 23c4b4d406..89dc20b530 100644 --- a/templates/shared/search/combo_multi.tmpl +++ b/templates/shared/search/combo_multi.tmpl @@ -7,18 +7,18 @@
{{template "shared/search/input" dict "Value" .Value "Disabled" .Disabled "Placeholder" .Placeholder}} +
+ {{ctx.Locale.Tr (printf "search.%s" .Selected)}} +
+ +
{{template "shared/search/button" dict "Disabled" .Disabled "Tooltip" .Tooltip}}