mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
325 lines
9.7 KiB
Plaintext
325 lines
9.7 KiB
Plaintext
{{ $model := . }}
|
|
{{/* .parameters
|
|
type SearchParameters struct {
|
|
Parameters
|
|
Sort string
|
|
|
|
Annotations bool
|
|
Persons bool
|
|
Title bool
|
|
Series bool
|
|
Places bool
|
|
Refs bool
|
|
Year bool
|
|
|
|
AnnotationsString string
|
|
PersonsString string
|
|
TitleString string
|
|
AlmString string
|
|
SeriesString string
|
|
PlacesString string
|
|
RefsString string
|
|
YearString string
|
|
|
|
TypeFilter string
|
|
}
|
|
type Parameters struct {
|
|
Query string
|
|
Collection string
|
|
Extended bool
|
|
}
|
|
type SearchResultBaende struct {
|
|
// these are the sorted IDs for hits
|
|
Hits []string
|
|
Series map[string]*dbmodels.Series // <- Key: Series ID
|
|
Entries map[string]*dbmodels.Entry // <- Key: Entry ID
|
|
Places map[string]*dbmodels.Place // <- All places, Key: Place IDs
|
|
Agents map[string]*dbmodels.Agent // <- Key: Agent IDs
|
|
|
|
EntriesSeries map[string][]*dbmodels.REntriesSeries // <- Key: Whatever the Hit IDs are
|
|
SeriesEntries map[string][]*dbmodels.REntriesSeries // <- Key: Whatever the Hit IDs are
|
|
EntriesAgents map[string][]*dbmodels.REntriesAgents // <- Key: Entry ID
|
|
}
|
|
*/}}
|
|
|
|
{{ $isAlm := false }}
|
|
{{ $isTitle := false }}
|
|
{{ $isRefs := false }}
|
|
{{ $isPlaces := false }}
|
|
{{ $isYear := false }}
|
|
{{ $isSeries := false }}
|
|
{{ $isPersons := false }}
|
|
{{ $isAnnotations := false }}
|
|
|
|
{{- $isAlm = $model.parameters.AlmString -}}
|
|
{{- $isTitle = or $model.parameters.Title $model.parameters.TitleString -}}
|
|
{{- $isRefs = or $model.parameters.Refs $model.parameters.RefsString -}}
|
|
{{- $isPlaces = or $model.parameters.Places $model.parameters.PlacesString -}}
|
|
{{- $isYear = or $model.parameters.Year $model.parameters.YearString -}}
|
|
{{- $isSeries = or $model.parameters.Series $model.parameters.SeriesString -}}
|
|
{{- $isPersons = or $model.parameters.Persons $model.parameters.PersonsString -}}
|
|
{{- $isAnnotations = or $model.parameters.Annotations $model.parameters.AnnotationsString -}}
|
|
|
|
{{- $isBase := not (or $isTitle $isRefs $isPlaces $isYear $isSeries $isPersons
|
|
$isAnnotations)
|
|
-}}
|
|
|
|
|
|
<div id="searchcontrol" class="container-normal">
|
|
{{- template "_heading" $model.parameters -}}
|
|
<div id="searchform" class="border-l border-zinc-300 px-8 py-10 relative">
|
|
{{- if not $model.parameters.Extended -}}
|
|
{{- template "_musenalmidbox" Arr $model.parameters.AlmString "baende" -}}
|
|
{{- end -}}
|
|
<form
|
|
id="simplesearchform"
|
|
class="w-full font-serif"
|
|
method="get"
|
|
hx-indicator="body"
|
|
action="/suche/baende"
|
|
autocomplete="off">
|
|
{{- if not $model.parameters.Extended -}}
|
|
<div class="searchformcolumn">
|
|
{{- $q := "" }}
|
|
{{- if $model.parameters.Query -}}
|
|
{{- $q = $model.parameters.Query -}}
|
|
{{- end -}}
|
|
{{ template "_searchboxsimple" Arr $model.parameters true $q }}
|
|
<fieldset class="selectgroup">
|
|
<div class="selectgroup-option">
|
|
<input
|
|
type="checkbox"
|
|
name="title"
|
|
id="title"
|
|
{{ if or $isBase $isTitle -}}checked{{- end -}} />
|
|
<label for="title">Titel</label>
|
|
</div>
|
|
<div class="selectgroup-option">
|
|
<input
|
|
type="checkbox"
|
|
name="series"
|
|
id="series"
|
|
{{ if or $isBase $isSeries -}}checked{{- end -}} />
|
|
<label for="series">Reihentitel</label>
|
|
</div>
|
|
<div class="selectgroup-option">
|
|
<input
|
|
type="checkbox"
|
|
name="persons"
|
|
id="persons"
|
|
{{ if or $isBase $isPersons -}}checked{{- end -}} />
|
|
<label for="persons">Personen & Verlage</label>
|
|
</div>
|
|
<div class="selectgroup-option">
|
|
<input
|
|
type="checkbox"
|
|
name="places"
|
|
id="places"
|
|
{{ if or $isBase $isPlaces -}}checked{{- end -}} />
|
|
<label for="places">Orte</label>
|
|
</div>
|
|
<div class="selectgroup-option">
|
|
<input
|
|
type="checkbox"
|
|
name="year"
|
|
id="year"
|
|
{{ if or $isBase $isYear -}}checked{{- end -}} />
|
|
<label for="year">Jahr</label>
|
|
</div>
|
|
<div class="selectgroup-option">
|
|
<input
|
|
type="checkbox"
|
|
name="references"
|
|
id="references"
|
|
{{ if or $isBase
|
|
$isRefs
|
|
-}}
|
|
checked
|
|
{{- end -}} />
|
|
<label for="references">Nachweise</label>
|
|
</div>
|
|
<div class="selectgroup-option">
|
|
<input
|
|
type="checkbox"
|
|
name="annotations"
|
|
id="annotations"
|
|
{{ if or $isBase
|
|
$isAnnotations
|
|
-}}
|
|
checked
|
|
{{- end -}} />
|
|
<label for="annotations">Anmerkungen</label>
|
|
</div>
|
|
</fieldset>
|
|
{{ template "_infotextsimple" true }}
|
|
</div>
|
|
{{- template "_fieldscript" -}}
|
|
{{- else -}}
|
|
<div id="extendedsearchcolumn" class="">
|
|
<input type="hidden" name="extended" value="true" />
|
|
<label for="titlestring">Titel</label>
|
|
<input
|
|
type="search"
|
|
name="titlestring"
|
|
id="titlestring"
|
|
value="{{ $model.parameters.TitleString }}" />
|
|
<label for="seriesstring">Reihentitel</label>
|
|
<input
|
|
type="search"
|
|
name="seriesstring"
|
|
id="seriesstring"
|
|
value="{{ $model.parameters.SeriesString }}" />
|
|
<label for="personsstring">Personen & Verlage</label>
|
|
<input
|
|
type="search"
|
|
name="personsstring"
|
|
id="personsstring"
|
|
value="{{ $model.parameters.PersonsString }}" />
|
|
<label for="placesstring">Orte</label>
|
|
<input
|
|
type="search"
|
|
name="placesstring"
|
|
id="placesstring"
|
|
value="{{ $model.parameters.PlacesString }}" />
|
|
<label for="yearstring">Jahr</label>
|
|
<input
|
|
type="search"
|
|
name="yearstring"
|
|
id="yearstring"
|
|
value="{{ $model.parameters.YearString }}" />
|
|
<label for="refsstring">Nachweise</label>
|
|
<input
|
|
type="search"
|
|
name="refsstring"
|
|
id="refsstring"
|
|
value="{{ $model.parameters.RefsString }}" />
|
|
<label for="annotationsstring">Anmerkungen</label>
|
|
<input
|
|
type="search"
|
|
name="annotationsstring"
|
|
id="annotationsstring"
|
|
value="{{ $model.parameters.AnnotationsString }}" />
|
|
<button id="submitbutton" type="submit" class="">Suchen</button>
|
|
<a href="/suche/baende" class="whitespace-nowrap"
|
|
><i class="ri-arrow-left-long-line"></i> Zurück zur einfachen Suche</a
|
|
>
|
|
</div>
|
|
{{- end -}}
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
{{- if $model.parameters.IsBaendeSearch -}}
|
|
<div class="container-normal" id="searchresults">
|
|
<div class="border-b border-zinc-300 flex flex-row justify-between">
|
|
<div class="flex flex-row">
|
|
<div class="inline-block">
|
|
<i class="ri-hourglass-2-fill request-indicator spinning"></i>
|
|
</div>
|
|
<div class="request-indicator">·</div>
|
|
<div>
|
|
{{ if $model.parameters.Query -}}
|
|
Suche nach <b>»{{ $model.parameters.Query }}«</b> ·
|
|
{{- end -}}
|
|
{{- if $isAlm -}}
|
|
Almanach-Nummer <b>»{{ $model.parameters.AlmString }}«</b> ·
|
|
{{- end -}}
|
|
<i class="ri-book-line"></i>
|
|
{{ if eq $model.result.Count 1 -}}
|
|
Ein Band
|
|
{{ else -}}
|
|
{{ $model.result.Count }} Bände
|
|
{{- end }}
|
|
in
|
|
{{ if eq ($model.result.Series | len) 1 -}}
|
|
einer Reihe
|
|
{{ else -}}
|
|
{{ $model.result.Series | len }} Reihen
|
|
{{- end -}}
|
|
</div>
|
|
|
|
{{- if gt (len $model.result.Pages) 1 }}
|
|
<div> · </div>
|
|
{{- end -}}
|
|
{{ template "_pagination" Arr $model "baende" }}
|
|
</div>
|
|
|
|
{{- if not $isAlm -}}
|
|
<div>
|
|
<label
|
|
for="sort"
|
|
class="align-baseline h-min self-end pb-1 mr-2 text-sm font-sans
|
|
text-stone-700"
|
|
>Sortierung</label
|
|
>
|
|
|
|
{{/* INFO: We always redrect to letter = A bc some letters dont exist for other professions */}}
|
|
<select
|
|
class="h-min pb-1 border-b-4 border-zinc-300 px-1.5"
|
|
name="sort"
|
|
id="sort"
|
|
hx-get="{{- $model.parameters.ToQueryParamsBaende -}}"
|
|
hx-indicator="body"
|
|
trigger="change"
|
|
hx-push-url="true"
|
|
hx-select="main"
|
|
auto-complete="off"
|
|
hx-target="main">
|
|
<option
|
|
value="year"
|
|
{{ if eq $model.parameters.Sort "year" -}}
|
|
selected
|
|
{{- end -}}>
|
|
Erscheinungsjahr
|
|
</option>
|
|
<option value="series" {{ if eq $model.parameters.Sort "series" -}}selected{{- end -}}>
|
|
Reihentitel A-Z
|
|
</option>
|
|
</select>
|
|
</div>
|
|
{{- end -}}
|
|
</div>
|
|
|
|
{{- if $model.result.Hits -}}
|
|
{{- if eq .parameters.Sort "series" -}}
|
|
<div class="mt-4">
|
|
{{- range $_, $hit := $model.result.Hits -}}
|
|
{{- $series := index $model.result.Series $hit -}}
|
|
<div class="font-serif font-bold py-1 border-b border-zinc-300 px-3 mt-6">
|
|
<span class="text-base font-sans pr-2 border-zinc-300">Reihe</span>
|
|
<span class="pl-2">{{ $series.Title }}</span>
|
|
</div>
|
|
{{- range $_, $rel := index $model.result.SeriesEntries $hit -}}
|
|
{{- $entry := index $model.result.Entries $rel.Entry -}}
|
|
{{- template "band" (Arr $model $entry $series.Id) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
</div>
|
|
{{- else -}}
|
|
{{- range $_, $hit := $model.result.Hits -}}
|
|
{{- $entry := index $model.result.Entries $hit -}}
|
|
{{- template "band" (Arr $model $entry false) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- if $model.result.Hits -}}
|
|
<div class="flex flex-row justify-end items-start border-t border-zinc-300 pt-4">
|
|
{{- template "_pagination" Arr $model "baende" -}}
|
|
</div>
|
|
{{- else -}}
|
|
<div class="container-normal">Keine Bände gefunden.</div>
|
|
{{- end -}}
|
|
|
|
<script type="module">
|
|
let elements = document.querySelectorAll('.search-text');
|
|
let mark_instance = new Mark(elements);
|
|
// INFO: we wait a little bit before marking, to settle everything
|
|
setTimeout(() => {
|
|
mark_instance.mark('{{ $model.parameters.AllSearchTermsBaende }}', {
|
|
"seperateWordSearch": true,
|
|
});
|
|
}, 200);
|
|
</script>
|
|
</div>
|
|
{{- end -}}
|