vole
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software:2222/vole.git
A free and open-source forge that lives in your Git repo.
Blame · server/web/templates/code_search.html
Line attribution on main · 74 line(s)
|
aef99284
Keenan Nemetz
15d ago
|
1 | {{define "code_search"}} |
| 2 | {{template "header" .}} | |
|
5d440e37
Keenan Nemetz
10d ago
|
3 | {{template "repohead" (nav .Page "code")}} |
|
aef99284
Keenan Nemetz
15d ago
|
4 | |
| 5 | <div class="page-head"> | |
| 6 | <div class="page-head-main"> | |
| 7 | <h1>Search code</h1> | |
| 8 | <p class="page-sub">File names and contents on <code>{{.Ref}}</code>. Content search is case-insensitive and treats the query as plain text.</p> | |
| 9 | </div> | |
| 10 | <div class="page-head-actions"> | |
|
ed03b3d1
Keenan Nemetz
6h ago
|
11 | <a class="button secondary" href="/{{.Name}}/code?ref={{esc .Ref}}">{{icon "code"}}Browse</a> |
|
aef99284
Keenan Nemetz
15d ago
|
12 | </div> |
| 13 | </div> | |
| 14 | ||
|
ed03b3d1
Keenan Nemetz
6h ago
|
15 | <form class="filters" method="get" action="/{{.Name}}/search" role="search"> |
|
aef99284
Keenan Nemetz
15d ago
|
16 | <input type="hidden" name="ref" value="{{.Ref}}"> |
|
6c98a271
Keenan Nemetz
9d ago
|
17 | <div class="filters-search"> |
| 18 | <input type="search" name="q" value="{{.Query}}" placeholder="Search file names and content" aria-label="Search file names and content" autofocus> | |
| 19 | <button type="submit">{{icon "search"}}Search</button> | |
| 20 | </div> | |
|
aef99284
Keenan Nemetz
15d ago
|
21 | </form> |
| 22 | ||
| 23 | {{if .Error}}<div class="flash bad">{{.Error}}</div>{{end}} | |
| 24 | ||
| 25 | {{if not .Commit}} | |
| 26 | <div class="empty-state"> | |
| 27 | <p>There is no commit on <code>{{.Ref}}</code> to search.</p> | |
| 28 | </div> | |
| 29 | {{else if not .Query}} | |
| 30 | <div class="empty-state"> | |
| 31 | <p>Search this repository.</p> | |
| 32 | <p class="muted">Names and file contents are searched at the selected branch. Binary files are skipped.</p> | |
| 33 | </div> | |
| 34 | {{else}} | |
| 35 | <p class="muted">{{.Hits}} content match(es){{if .FileHits}} · {{len .FileHits}} file name match(es){{end}} for “{{.Query}}”{{if .Truncated}} · showing a partial result set{{end}}</p> | |
| 36 | ||
| 37 | <h2>Files</h2> | |
| 38 | {{if .FileHits}} | |
| 39 | <div class="panel"> | |
| 40 | <table class="search-files"> | |
| 41 | <tbody> | |
| 42 | {{range .FileHits}} | |
|
ed03b3d1
Keenan Nemetz
6h ago
|
43 | <tr><td><a href="/{{$.Name}}/blob/{{esc $.Ref}}/{{pathurl .}}" hx-get="/{{$.Name}}/blob/{{esc $.Ref}}/{{pathurl .}}" hx-target="#code-main" hx-swap="outerHTML" hx-push-url="true">{{icon (fileicon .)}}{{.}}</a></td></tr> |
|
aef99284
Keenan Nemetz
15d ago
|
44 | {{end}} |
| 45 | </tbody> | |
| 46 | </table> | |
| 47 | </div> | |
| 48 | {{else}} | |
|
c7b9094f
Keenan Nemetz
1d ago
|
49 | <div class="empty-state"><p>No file names match.</p></div> |
|
aef99284
Keenan Nemetz
15d ago
|
50 | {{end}} |
| 51 | ||
| 52 | <h2>Content</h2> | |
| 53 | {{if .Groups}} | |
| 54 | {{range .Groups}}{{$g := .}} | |
| 55 | <section class="search-group"> | |
|
ed03b3d1
Keenan Nemetz
6h ago
|
56 | <h3><a href="/{{$.Name}}/blob/{{esc $.Ref}}/{{pathurl .Path}}">{{.Path}}</a></h3> |
|
aef99284
Keenan Nemetz
15d ago
|
57 | <table class="search-lines"> |
| 58 | <tbody> | |
| 59 | {{range .Lines}} | |
| 60 | <tr id="L{{.Line}}"> | |
|
ed03b3d1
Keenan Nemetz
6h ago
|
61 | <td class="ln"><a href="/{{$.Name}}/blob/{{esc $.Ref}}/{{pathurl $g.Path}}#L{{.Line}}">{{.Line}}</a></td> |
|
aef99284
Keenan Nemetz
15d ago
|
62 | <td class="code">{{.Text}}</td> |
| 63 | </tr> | |
| 64 | {{end}} | |
| 65 | </tbody> | |
| 66 | </table> | |
| 67 | </section> | |
| 68 | {{end}} | |
| 69 | {{else}} | |
|
c7b9094f
Keenan Nemetz
1d ago
|
70 | <div class="empty-state"><p>No file content matches.</p></div> |
|
aef99284
Keenan Nemetz
15d ago
|
71 | {{end}} |
| 72 | {{end}} | |
| 73 | {{template "footer" .}} | |
| 74 | {{end}} |