code-search: make linters happy again
This commit is contained in:
parent
d2efdda911
commit
a98cf0e68e
3 changed files with 15 additions and 19 deletions
|
@ -35,11 +35,9 @@ func Code(ctx *context.Context) {
|
||||||
language := ctx.FormTrim("l")
|
language := ctx.FormTrim("l")
|
||||||
keyword := ctx.FormTrim("q")
|
keyword := ctx.FormTrim("q")
|
||||||
|
|
||||||
isFuzzy := true
|
isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
|
||||||
if mode := ctx.FormTrim("mode"); len(mode) > 0 {
|
if mode := ctx.FormTrim("mode"); len(mode) > 0 {
|
||||||
isFuzzy = mode == "fuzzy"
|
isFuzzy = mode == "fuzzy"
|
||||||
} else {
|
|
||||||
isFuzzy = ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["Keyword"] = keyword
|
ctx.Data["Keyword"] = keyword
|
||||||
|
|
|
@ -40,11 +40,9 @@ func CodeSearch(ctx *context.Context) {
|
||||||
language := ctx.FormTrim("l")
|
language := ctx.FormTrim("l")
|
||||||
keyword := ctx.FormTrim("q")
|
keyword := ctx.FormTrim("q")
|
||||||
|
|
||||||
isFuzzy := true
|
isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
|
||||||
if mode := ctx.FormTrim("mode"); len(mode) > 0 {
|
if mode := ctx.FormTrim("mode"); len(mode) > 0 {
|
||||||
isFuzzy = mode == "fuzzy"
|
isFuzzy = mode == "fuzzy"
|
||||||
} else {
|
|
||||||
isFuzzy = ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["Keyword"] = keyword
|
ctx.Data["Keyword"] = keyword
|
||||||
|
|
|
@ -7,18 +7,18 @@
|
||||||
<div class="ui small fluid action input">
|
<div class="ui small fluid action input">
|
||||||
{{template "shared/search/input" dict "Value" .Value "Disabled" .Disabled "Placeholder" .Placeholder}}
|
{{template "shared/search/input" dict "Value" .Value "Disabled" .Disabled "Placeholder" .Placeholder}}
|
||||||
<div class="ui small dropdown selection {{if .Disabled}} disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "search.type_tooltip"}}">
|
<div class="ui small dropdown selection {{if .Disabled}} disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "search.type_tooltip"}}">
|
||||||
<div class="text">
|
<div class="text">
|
||||||
{{ctx.Locale.Tr (printf "search.%s" .Selected)}}
|
{{ctx.Locale.Tr (printf "search.%s" .Selected)}}
|
||||||
</div>
|
</div>
|
||||||
<div class="menu" data-test-tag="fuzzy-dropdown">
|
<div class="menu" data-test-tag="fuzzy-dropdown">
|
||||||
{{range $opt := .Options}}
|
{{range $opt := .Options}}
|
||||||
{{$isActive := eq $.Selected $opt}}
|
{{$isActive := eq $.Selected $opt}}
|
||||||
<label class="{{if $isActive}}active {{end}}item" data-value="{{$opt}}" data-tooltip-content="{{ctx.Locale.Tr (printf "search.%s_tooltip" $opt)}}">
|
<label class="{{if $isActive}}active {{end}}item" data-value="{{$opt}}" data-tooltip-content="{{ctx.Locale.Tr (printf "search.%s_tooltip" $opt)}}">
|
||||||
<input hidden type="radio" name="mode" value="{{$opt}}"{{if $isActive}} checked{{end}}/>
|
<input hidden type="radio" name="mode" value="{{$opt}}"{{if $isActive}} checked{{end}}/>
|
||||||
{{ctx.Locale.Tr (printf "search.%s" $opt)}}
|
{{ctx.Locale.Tr (printf "search.%s" $opt)}}
|
||||||
</label>
|
</label>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{template "shared/search/button" dict "Disabled" .Disabled "Tooltip" .Tooltip}}
|
{{template "shared/search/button" dict "Disabled" .Disabled "Tooltip" .Tooltip}}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue