{{ define "title" }}Search — Facette{{ end }}

{{ define "head" }}
		<link rel="search" href="{{ .URLPrefix }}/browse/opensearch.xml" title="Add {{ .Request.Host }} search" type="application/opensearchdescription+xml">
		<script src="{{ .URLPrefix }}{{ asset "/static/jquery.js" }}"></script>
		<script src="{{ .URLPrefix }}{{ asset "/static/i18next.js" }}"></script>
		<script src="{{ .URLPrefix }}{{ asset "/static/facette.js" }}"></script>
{{ end }}

{{ define "content" }}{{ $prefix := .URLPrefix }}{{ $q := .Request.FormValue "q" }}
		<nav>
			<dl class="graphlist">
				<dt>Menu</dt>
				<dd><a href="{{ .URLPrefix }}/browse/"><span class="icon icon-arrow-left"></span> Back to Collections</a></dd>
			</dl>
		</nav>


		<article>
			<header>
				<h1>Search</h1>
			</header>

			<section class="scrollarea full">
				<div class="block">
					<form action="{{ .URLPrefix }}/browse/search" method="get">
						<p>Search for Source or Collection:</p>
						<p>
							<input class="full" name="q" placeholder="e.g. host1.example.net, collection1" type="text" value="{{ $q }}">
						</p>
					</form>
				</div>

				<div class="block">
					<h1>Result <span class="count">{{ .Count }}</span></h1>
					{{ if eq .Count 0 }}
					<p class="mesgitem warning">Couldn’t find any item matching “{{ $q }}”</p>{{ else }}
					<div class="list">{{ range .Collections }}
						<div class="listitem">
							<div class="name"><a href="{{ $prefix }}/browse/collections/{{ .ID }}">{{ .Name }}</a></div>
							<div class="desc">Collection</div>
						</div>{{ end }}{{ range .Graphs }}
						<div class="listitem">
							<div class="name"><a href="{{ $prefix }}/browse/graphs/{{ .ID }}">{{ .Name }}</a></div>
							<div class="desc">Graph</div>
						</div>{{ end }}
					</div>{{ end }}
				</div>
			</section>
		</article>
{{ end }}
