docstore/pkg/server/templates/search.html
2021-02-18 22:36:49 +01:00

71 lines
2.2 KiB
HTML

{{define "body"}}
<div class="page-header">
<div class="row">
<h2>{{.BodyTitle}}</h2>
</div>
</div>
<div class="row mt-3">
<div class="col col-nopad">
<form class="form-horizontal" action="/search" method="post">
<input type="hidden" name="token" value="{{.Token}}">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control input-sm" placeholder="Query" name="query" value="{{.Query}}" autocomplete="off" autofocus>
<div class="input-group-append">
<button class="btn btn-sm btn-primary" type="submit">Search</button>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="row mt-3">
{{if .Data}}
<table class="table table-stripped table-hover">
<thead>
<tr>
<th>File</th>
<th>Tags</th>
</tr>
</thead>
<tbody>
{{range $item := .Data}}
<tr>
<td>
<a class="mono" href="{{$item.Path}}"><b>{{$item.Path}}</b></a>
{{if $item.HTML}}
<br><pre class="wrap">{{$item.HTML}}</pre>
{{end}}
</td>
<td>
{{range $t := $item.Tags}}
<a href="/search?query=tags:{{$t}}" class="btn badge btn-primary">{{$t}}</a>
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
{{else}}
<b>No search results found.</b>
</div>
<div class="row mt-3">
<div class="col col-nopad">
<div class="alert alert-primary">
<h4>Query Syntax</h4>
<p>Documentation: <a target="_blank" rel="noopener noreferrer" href="https://github.com/bcampbell/qs/blob/master/syntax.md">https://github.com/bcampbell/qs/blob/master/syntax.md</a></p>
<p>Fields</p>
<pre><code>tags:insurance
tags:insurance OR tags:invoice
# combine tags
tags:insurance AND tags:invoice
# exclude tags
tags:insurance -tags:invoice
created:&lt;="2016-09-21"</code></pre>
<p>Fulltext</p>
<pre><code>some text here</code></pre>
</div>
</div>
{{end}}
</div>
{{end}}