website/web/templates/forum/search.html
2024-03-30 15:59:29 -07:00

196 lines
7.2 KiB
HTML

{{define "title"}}Newest Posts - Forums{{end}}
{{define "content"}}
<div class="block">
<section class="hero is-light is-success">
<div class="hero-body">
<h1 class="title">
<span class="icon mr-4"><i class="fa fa-comments"></i></span>
<span>Forums</span>
</h1>
<h2 class="subtitle">
<i class="fa fa-search mr-1"></i> Search
</h2>
</div>
</section>
</div>
{{$Root := .}}
<div class="block p-4 mb-0">
<div class="tabs is-boxed">
<ul>
<li>
<a href="/forum">
Categories
</a>
</li>
<li>
<a href="/forum/newest">
Newest
</a>
</li>
<li class="is-active">
<a href="/forum/search">
<i class="fa fa-search mr-2"></i> Search
</a>
</li>
</ul>
</div>
</div>
<!-- Search fields -->
<div class="p-4">
<form action="{{.Request.URL.Path}}" method="GET">
<div class="card nonshy-collapsible-mobile">
<header class="card-header has-background-link-light">
<p class="card-header-title has-text-dark">
Search Filters
</p>
<button class="card-header-icon" type="button">
<span class="icon">
<i class="fa fa-angle-up"></i>
</span>
</button>
</header>
<div class="card-content">
<div class="columns">
<div class="column pr-1">
<div class="field">
<label class="label" for="q">Search terms:</label>
<input type="text" class="input"
name="q" id="q"
autocomplete="off"
value="{{.SearchTerm}}">
<p class="help">
Tip: you can <span class="has-text-success">"quote exact phrases"</span> and
<span class="has-text-success">-exclude</span> words (or
<span class="has-text-success">-"exclude phrases"</span>) from your search.
</p>
</div>
</div>
<div class="column px-1">
<div class="field">
<label class="label" for="username">Written by username:</label>
<input type="text" class="input"
name="username" id="username"
autocomplete="off"
value="{{.ByUsername}}">
</div>
</div>
</div>
<div class="columns">
<div class="column px-1">
<div class="field">
<label class="label" for="type">Show:</label>
<div class="select is-fullwidth">
<select id="type" name="type">
<option value="all"{{if eq .Type "all"}} selected{{end}}>All threads and replies</option>
<option value="threads"{{if eq .Type "threads"}} selected{{end}}>Threads only</option>
</select>
</div>
</div>
</div>
<div class="column px-1">
<div class="field">
<label class="label" for="sort">Sort by:</label>
<div class="select is-fullwidth">
<select id="sort" name="sort">
<option value="created_at desc"{{if eq .Sort "created_at desc"}} selected{{end}}>Newest</option>
<option value="created_at asc"{{if eq .Sort "created_at asc"}} selected{{end}}>Oldest</option>
</select>
</div>
</div>
</div>
<div class="column is-narrow pl-1 has-text-right">
<label class="label">&nbsp;</label>
<a href="{{.Request.URL.Path}}" class="button">Reset</a>
<button type="submit" class="button is-success">
<span>Search</span>
<span class="icon"><i class="fa fa-search"></i></span>
</button>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="p-4">
Found {{FormatNumberCommas .Pager.Total}} posts (page {{.Pager.Page}} of {{.Pager.Pages}})
</div>
<div class="p-4">
{{SimplePager .Pager}}
</div>
<div class="p-4">
{{range .Comments}}
{{$Thread := $Root.ThreadMap.Get .ID}}
<div class="card block has-background-link-light">
<div class="card-content">
<div class="columns">
<div class="column is-narrow has-text-centered pt-0 pb-1">
<a href="/u/{{.User.Username}}">
{{template "avatar-96x96" .User}}
<div>
<a href="/u/{{.User.Username}}" class="is-size-7">{{or .User.Username "[unavailable]"}}</a>
</div>
</a>
</div>
<div class="column py-0">
<div class="columns is-multiline is-gapless mb-0">
<div class="column is-narrow">
<a href="/go/comment?id={{.ID}}" class="has-text-grey">
<h2 class="is-size-5 py-0 is-italic has-text-grey">
On thread:
{{if $Thread}}
{{$Thread.Title}}
{{else}}
[unavailable]
{{end}}
</h2>
</a>
</div>
</div>
<a href="/go/comment?id={{.ID}}" class="has-text-dark">
{{TrimEllipses .Message 512}}
</a>
{{$Photos := $Root.PhotoMap.Get .ID}}
{{if $Photos}}
<div class="is-size-7 mt-2 has-text-success">
<i class="fa fa-image pr-1"></i>
Photo attachment
</div>
{{end}}
<div class="is-size-7 is-italic is-grey mt-1">
{{SincePrettyCoarse .UpdatedAt}} ago
</div>
</div>
</div>
</div>
</div>
{{end}}
</div>
<div class="p-4">
{{SimplePager .Pager}}
</div>
{{end}}