mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-21 08:31:27 -05:00
928f188689
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> ![1](https://codeberg.org/attachments/5173357f-8dce-470c-9a9e-84a30517c216) </details> <details> <summary>After</summary> ![after](https://codeberg.org/attachments/f8ec15dd-08ce-41f2-9326-d823de6f2395) </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>
25 lines
870 B
Go HTML Template
25 lines
870 B
Go HTML Template
<div class="file-body file-code code-view">
|
|
<div>
|
|
<ol class="tw-p-0 tw-m-0">
|
|
{{/* if the expected line number does not match
|
|
the actual line number end the ordered list
|
|
and begin a new one */}}
|
|
{{$expNum := 0}}
|
|
{{range .SearchResult.Lines}}
|
|
{{if and (gt $expNum 0) (ne .Num $expNum)}}
|
|
</ol>
|
|
<ol class="tw-p-0 tw-m-0 tw-pt-2 tw-mt-2 tw-border-t-4 tw-border-secondary">
|
|
{{end}}
|
|
<li value="{{.Num}}" class="tw-grid tw-grid-cols-[minmax(50px,_1%)_auto] tw-list-none">
|
|
<div class="lines-num">
|
|
<a href="{{$.RepoLink}}/src/commit/{{PathEscape $.SearchResult.CommitID}}/{{PathEscapeSegments $.SearchResult.Filename}}#L{{.Num}}">
|
|
{{.Num}}
|
|
</a>
|
|
</div>
|
|
<div class="lines-code chroma"><code class="code-inner">{{.FormattedContent}}</code></div>
|
|
</li>
|
|
{{$expNum = Eval .Num "+" 1}}
|
|
{{end}}
|
|
</ol>
|
|
</div>
|
|
</div>
|