ui(code-search): fix to use CodeSearchMode

Drop unused IsFuzzy and IsRegExp
This commit is contained in:
Radosław Piliszek 2024-08-27 17:11:48 +02:00
parent 7068456d20
commit d2efdda911
5 changed files with 2 additions and 6 deletions

View file

@ -45,7 +45,6 @@ func Code(ctx *context.Context) {
ctx.Data["Keyword"] = keyword
ctx.Data["Language"] = language
ctx.Data["CodeSearchOptions"] = []string{"exact", "fuzzy"}
ctx.Data["IsFuzzy"] = isFuzzy
if isFuzzy {
ctx.Data["CodeSearchMode"] = "fuzzy"
} else {

View file

@ -63,8 +63,6 @@ func Search(ctx *context.Context) {
ctx.Data["Keyword"] = keyword
ctx.Data["Language"] = language
ctx.Data["IsFuzzy"] = mode == FuzzySearchMode
ctx.Data["IsRegExp"] = mode == RegExpSearchMode
ctx.Data["CodeSearchMode"] = mode.String()
ctx.Data["PageIsViewCode"] = true

View file

@ -50,7 +50,6 @@ func CodeSearch(ctx *context.Context) {
ctx.Data["Keyword"] = keyword
ctx.Data["Language"] = language
ctx.Data["CodeSearchOptions"] = []string{"exact", "fuzzy"}
ctx.Data["IsFuzzy"] = isFuzzy
if isFuzzy {
ctx.Data["CodeSearchMode"] = "fuzzy"
} else {

View file

@ -5,7 +5,7 @@
{{if $.CodeIndexerDisabled}}
{{$branchURLPrefix := printf "%s/search/branch/" $.RepoLink}}
{{$tagURLPrefix := printf "%s/search/tag/" $.RepoLink}}
{{$suffix := printf "?q=%s&fuzzy=%t" (.Keyword|QueryEscape) .IsFuzzy}}
{{$suffix := printf "?q=%s&mode=%s" (.Keyword|QueryEscape) .CodeSearchMode}}
{{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "tw-mb-3" "branchURLPrefix" $branchURLPrefix "branchURLSuffix" $suffix "tagURLPrefix" $tagURLPrefix "tagURLSuffix" $suffix}}
{{end}}
{{template "shared/search/code/search" .}}

View file

@ -1,7 +1,7 @@
<div class="flex-text-block tw-flex-wrap">
{{range $term := .SearchResultLanguages}}
<a class="ui {{if eq $.Language $term.Language}}primary{{end}} basic label tw-m-0"
href="?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}&fuzzy={{$.IsFuzzy}}">
href="?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}&mode={{$.CodeSearchMode}}">
<i class="color-icon tw-mr-2" style="background-color: {{$term.Color}}"></i>
{{$term.Language}}
<div class="detail">{{$term.Count}}</div>