mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-02-18 20:12:34 -05:00

various improvements from [user research](https://codeberg.org/forgejo/user-research/src/branch/main/interviews/2024-06/issues%28search%2Cfeatures%29%2Cselfhosting%2CCI%2Caccessibility%2Ccodesearch.md) - filenames are links to the respective files fixes: `fold menu: user clicked and expected to view file, instead the file collapsed` - refactor(searchfile.tmpl): ordered lists with lines grouped together instead of table fixes: `multiple matches per file are "merged", only visible in the code lines (no visual separation)` - feat: display fuzzy as "Either" when using git-grep which is much more accurate than "fuzzy" git-grep does not support fuzzy searching, in this context selecting fuzzy searching worked similar to an OR of white space separated keywords fixes: `typo doesn't bring results in fuzzy search` --- <details> <summary>Before</summary>  </details> <details> <summary>After</summary>  </details> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4332 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
21 lines
1.1 KiB
Go HTML Template
21 lines
1.1 KiB
Go HTML Template
{{/* Disabled (optional) - if dropdown has to be disabled */}}
|
|
{{/* IsFuzzy - state of the fuzzy search toggle */}}
|
|
<div class="ui small dropdown selection {{if .Disabled}} disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "search.type_tooltip"}}" data-test-tag="fuzzy-dropdown">
|
|
{{$fuzzyType := "fuzzy"}}
|
|
{{if .CodeIndexerDisabled}}
|
|
{{$fuzzyType = "union"}}
|
|
{{end}}
|
|
<input name="fuzzy" type="hidden"{{if .Disabled}} disabled{{end}} value="{{.IsFuzzy}}">{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
|
<div class="text">{{/*
|
|
if code indexer is disabled display fuzzy as union
|
|
*/}}{{if .IsFuzzy}}{{/*
|
|
*/}}{{ctx.Locale.Tr (printf "search.%s" $fuzzyType)}}{{/*
|
|
*/}}{{else}}{{/*
|
|
*/}}{{ctx.Locale.Tr "search.exact"}}{{/*
|
|
*/}}{{end}}</div>
|
|
<div class="menu">
|
|
<div class="item" data-value="true" data-tooltip-content="{{ctx.Locale.Tr (printf "search.%s_tooltip" $fuzzyType)}}">{{/*
|
|
*/}}{{ctx.Locale.Tr (printf "search.%s" $fuzzyType)}}</div>
|
|
<div class="item" data-value="false" data-tooltip-content="{{ctx.Locale.Tr "search.exact_tooltip"}}">{{ctx.Locale.Tr "search.exact"}}</div>
|
|
</div>
|
|
</div>
|