ui(code-search): fix to use CodeSearchMode
Drop unused IsFuzzy and IsRegExp
This commit is contained in:
parent
7068456d20
commit
d2efdda911
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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" .}}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue