hot reload, search refactor begin

This commit is contained in:
Simon Martens
2025-02-25 19:23:00 +01:00
parent f35c738cee
commit 4d65b71563
24 changed files with 706 additions and 202 deletions

View File

@@ -0,0 +1,61 @@
{{ $model := . }}
<div id="searchcontrol" class="container-normal">
{{- template "_heading" $model.parameters.Parameters -}}
<div id="" class="border-l border-zinc-300 px-8 py-10 relative">
{{- if not $model.parameters.Extended -}}
<form
id="searchform"
class="w-full font-serif"
method="get"
action="/suche/baende"
autocomplete="off">
<div class="searchformcolumn">
{{- $q := "" }}
{{- if $model.parameters.Query -}}
{{- q = $model.parameters.Query -}}
{{- end -}}
{{ template "_searchboxsimple" Arr $model.parameters.Parameters true $q }}
<fieldset class="selectgroup">
<div class="selectgroup-option">
<input type="checkbox" name="alm" id="alm" checked />
<label for="alm">Almanach-Nr.</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="title" id="title" checked />
<label for="title">Titel</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="series" id="series" checked />
<label for="series">Reihentitel</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="persons" id="persons" checked />
<label for="persons">Personen &amp; Verlage</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="pubdata" id="pubdata" checked />
<label for="pubdata">Orte</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="year" id="year" checked />
<label for="year">Jahr</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="references" id="references" checked />
<label for="references">Nachweise</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="annotations" id="annotations" checked />
<label for="annotations">Anmerkungen</label>
</div>
</fieldset>
{{ template "infotextsimple" true }}
</div>
</form>
</div>
</div>
{{- template "_fieldscript" -}}

View File

@@ -0,0 +1 @@
<title>{{ .site.title }}: Suche &ndash; Bände</title>

View File

@@ -0,0 +1,48 @@
{{ $model := . }}
<div id="searchcontrol" class="container-normal">
{{- template "_heading" $model.parameters.Parameters -}}
<div id="" class="border-l border-zinc-300 px-8 py-10 relative">
{{- if not $model.parameters.Extended -}}
<form
id="searchform"
class="w-full font-serif"
method="get"
action="/suche/baende"
autocomplete="off">
<div class="searchformcolumn">
{{- $q := "" }}
{{- if $model.parameters.Query -}}
{{- q = $model.parameters.Query -}}
{{- end -}}
{{ template "_searchboxsimple" Arr $model.parameters.Parameters true $q }}
<fieldset class="selectgroup">
<div class="selectgroup-option">
<input type="checkbox" name="number" id="number" checked />
<label for="number">Almanach-Nr.</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="title" id="title" checked />
<label for="title">Titelinformationen</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="entry" id="entry" checked />
<label for="entry">Bandtitel</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="person" id="person" checked />
<label for="person">Personen &amp; Pseudonyme</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="annotations" id="annotations" checked />
<label for="annotations">Anmerkungen</label>
</div>
</fieldset>
{{ template "infotextsimple" true }}
</div>
</form>
</div>
</div>
{{- template "_fieldscript" -}}

View File

@@ -0,0 +1 @@
<title>{{ .site.title }}: Suche &ndash; Beiträge</title>

View File

@@ -0,0 +1,17 @@
<script type="module">
let fieldset = document.querySelector("fieldset.selectgroup");
let checkboxes = Array.from(fieldset.querySelectorAll('input[type="checkbox"]'));
fieldset.addEventListener("change", (event) => {
let target = event.target;
if (target.type === "checkbox") {
let name = target.name;
let checked = target.checked;
if (!checked) {
let allchecked = checkboxes.filter((checkbox) => checkbox.checked);
if (allchecked.length === 0) {
target.checked = true;
}
}
}
});
</script>

View File

@@ -0,0 +1,53 @@
{{- $model := . -}}
<div id="searchheading" class="flex flex-row justify-between min-h-14 items-end relative">
<nav id="searchnav" class="flex flex-row items-end">
<div
class="align-bottom text-lg h-min self-end pb-0.5 italic font-bold
text-zinc-800">
Suche nach:
</div>
<!--
<a
href="/suche/reihen"
class="block no-underline"
{{ if eq $model.Collection "reihen" }}aria-current="page"{{- end -}}
>Reihen</a
>
-->
<a
href="/suche/baende"
class="block no-underline"
{{ if eq $model.Collection "baende" }}aria-current="page"{{- end -}}
>Bänden</a
>
<a
href="/suche/beitraege"
class="block no-underline"
{{ if eq $model.Collection "beitraege" }}aria-current="page"{{- end -}}
>Beiträgen</a
>
<!--
<a
href="/suche/personen"
class="block no-underline"
{{ if eq $model.Collection "personen" }}aria-current="page"{{- end -}}
>Personen</a
>
-->
</nav>
<h1
class="text-3xl font-bold px-3 relative translate-y-[45%] w-min whitespace-nowrap
bg-stone-50 mr-24 z-20">
Suche&nbsp;&middot;&nbsp;<span class="">
{{- if eq $model.Collection "reihen" -}}
Reihen
{{- else if eq $model.Collection "personen" -}}
Personen &amp; Körperschaften
{{- else if eq $model.Collection "baende" -}}
Bände
{{- else if eq $model.Collection "beitraege" -}}
Beiträge
{{- end -}}
</span>
</h1>
</div>

View File

@@ -1,10 +1,11 @@
{{ $model := index . 0 }}
{{ $parameters := index . 0 }}
{{ $extendable := index . 1 }}
{{ $q := index . 2 }}
<label for="q" class="hidden">Suchbegriffe</label>
<input
{{ if $model.q }}value="{{ $model.q }}"{{- end -}}
{{ if $q }}value="{{ $q }}"{{- end -}}
type="search"
name="q"
minlength="3"
@@ -16,7 +17,7 @@
{{ if $extendable }}
<a
href="/suche/{{ $model.type }}?extended=true"
href="/suche/{{ $parameters.Collection }}?extended=true"
class="whitespace-nowrap self-end block col-span-2">
<i class="ri-arrow-right-long-line"></i> Erweiterte Suche
</a>

View File

@@ -97,44 +97,6 @@
{{- else if eq $model.type "baende" -}}
<!-- INFO: Bände -->
{{- if not $model.extended -}}
<div class="grid grid-cols-12 gap-y-3 w-full gap-x-4">
{{ template "searchboxsimple" Arr . true }}
<fieldset class="selectgroup">
<div class="selectgroup-option">
<input type="checkbox" name="number" id="number" checked />
<label for="number">Almanach-Nr.</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="title" id="title" checked />
<label for="title">Titel</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="series" id="series" checked />
<label for="series">Reihentitel</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="person" id="person" checked />
<label for="person">Personen &amp; Verlage</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="pubdata" id="pubdata" checked />
<label for="pubdata">Orte</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="year" id="year" checked />
<label for="year">Jahr</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="references" id="references" checked />
<label for="references">Nachweise</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="annotations" id="annotations" checked />
<label for="annotations">Anmerkungen</label>
</div>
</fieldset>
{{ template "infotextsimple" true }}
</div>
{{- else -}}
Extended search Bände
{{- end -}}
@@ -144,28 +106,6 @@
{{- if not $model.extended -}}
<div class="grid grid-cols-12 gap-y-3 w-full gap-x-4">
{{ template "searchboxsimple" Arr . true }}
<fieldset class="selectgroup">
<div class="selectgroup-option">
<input type="checkbox" name="number" id="number" checked />
<label for="number">Almanach-Nr.</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="title" id="title" checked />
<label for="title">Titelinformationen</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="entry" id="entry" checked />
<label for="entry">Bandtitel</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="person" id="person" checked />
<label for="person">Personen &amp; Pseudonyme</label>
</div>
<div class="selectgroup-option">
<input type="checkbox" name="annotations" id="annotations" checked />
<label for="annotations">Anmerkungen</label>
</div>
</fieldset>
{{ template "infotextsimple" true }}
</div>
{{- else -}}
@@ -173,21 +113,3 @@
{{- end -}}
{{- end -}}
</form>
<script type="module">
let fieldset = document.querySelector("fieldset.selectgroup");
let checkboxes = Array.from(fieldset.querySelectorAll('input[type="checkbox"]'));
fieldset.addEventListener("change", (event) => {
let target = event.target;
if (target.type === "checkbox") {
let name = target.name;
let checked = target.checked;
if (!checked) {
let allchecked = checkboxes.filter((checkbox) => checkbox.checked);
if (allchecked.length === 0) {
target.checked = true;
}
}
}
});
</script>

View File

@@ -1 +0,0 @@
<title>{{ .site.title }}: Suche</title>

View File

@@ -0,0 +1 @@
<title>{{ .site.title }}: Suche &ndash; Reihen</title>