Notfifications /reihen

This commit is contained in:
Simon Martens
2025-02-21 17:02:16 +01:00
parent ca1320608f
commit 0d79239fd8
9 changed files with 214 additions and 93 deletions

View File

@@ -43,7 +43,7 @@ func (p *ReihePage) Setup(router *router.Router[*core.RequestEvent], app core.Ap
return Error404(e, engine, err, data)
}
data["relations"] = rmap
data["relations"] = rmap[reihe.Id]
data["entries"] = emap
return p.Get(e, engine, data)

View File

@@ -151,7 +151,6 @@ func (p *ReihenPage) PlaceRequest(app core.App, engine *templating.Engine, e *co
}
// TODO: Suchverhalten bei gefilterten Personen, Orten und Jahren
// TODO: FTS-Suche für alt. Ergebnisse
func (p *ReihenPage) SearchRequest(app core.App, engine *templating.Engine, e *core.RequestEvent) error {
search := e.Request.URL.Query().Get(PARAM_SEARCH)
data := map[string]interface{}{}

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,7 @@
{{ $model := . }}
{{ if $model.letters }}
<div
class="flex flex-row border-b px-3 border-zinc-300 items-end min-h-14"
x-data="{ search : '{{ $model.search }}' }">
<div class="flex flex-row border-b px-3 border-zinc-300 items-end min-h-14">
<div id="alphabet" class="alphabet flex flex-row items-end text-xl">
{{ range $id, $r := .letters }}
<a
@@ -23,10 +21,7 @@
<div class="flex-grow"></div>
<div
class="min-w-[22.5rem] max-w-96 flex flex-row bg-stone-50 relative"
:class="search ?
'activesearch' : ''">
<div class="min-w-[22.5rem] max-w-96 flex flex-row bg-stone-50 relative">
<div class="pb-0">
<i class="ri-search-line"></i><i class="-ml-0.5 inline-block ri-arrow-right-s-line"></i>
</div>
@@ -36,14 +31,16 @@
type="search"
name="search"
value="{{ $model.search }}"
x-model="search"
placeholder="Almanach-Nr oder Suchbegriff"
x-model="search"
hx-get=""
hx-trigger="input changed delay=1000ms, keyup[key=='Enter']"
hx-trigger="input changed delay=500ms, keyup[key=='Enter']"
hx-sync="this:replace"
hx-select="#searchcontent"
hx-target="#searchcontent"
autocomplete="off" />
autocomplete="off"
{{ if $model.active }}autofocus="true"{{ end }}
{{ if $model.search }}disabled="true"{{ end }} />
</div>
<div id="permalink" class="font-serif ml-3 min-w-7 pb-1">
<a

View File

@@ -1,9 +1,10 @@
{{ $model := index . 0 }}
{{ $r := index . 1 }}
{{ $showidseries := index . 2 }}
{{ $markar := index . 3 }}
{{ $r := index . 0 }}
{{ $entries := index . 1 }}
{{ $relations := index . 2 }}
{{ $showidseries := index . 3 }}
{{ $markar := index . 4 }}
{{ $bds := index $model.relations $r.Id }}
{{ $bds := index $relations $r.Id }}
<div class="flex flex-row mb-1.5">
@@ -18,7 +19,7 @@
<div class="font-sans text-sm px-2 py-1 bg-stone-100 searchable my-0.5">
Almanach-Nr.
<span class="reihen-text">
{{ (index $model.entries
{{ (index $entries
$rel.Entry).MusenalmID
}}
</span>
@@ -41,20 +42,7 @@
</div>
<div></div>
<div class="ml-3">
{{ if $bds }}
{{ range $_, $rel := $bds }}
{{ $bd := index $model.entries $rel.Entry }}
{{ if $bd }}
<a href="/almanach/{{ $bd.MusenalmID }}">
{{ if ne $bd.Year 0 }}
{{ $bd.Year }}
{{ else }}
[o.J.]
{{ end }} </a
>&ensp;
{{ end }}
{{ end }}
{{ end }}
{{ template "_reiherelations" (Arr $r $bds $entries false) }}
</div>
</div>
</div>

View File

@@ -0,0 +1,22 @@
{{ $reihe := index . 0 }}
{{ $rels := index . 1 }}
{{ $entries := index . 2 }}
{{ $shownos := index . 3 }}
{{ if $rels }}
{{ range $_, $rel := $rels }}
{{ $bd := index $entries $rel.Entry }}
{{ if $bd }}
<a href="/almanach/{{ $bd.MusenalmID }}">
{{ if ne $bd.Year 0 }}
{{ $bd.Year }}
{{ else }}
[o.J.]
{{ end }} </a
>&ensp;
{{ if $shownos }}
{{ $bd.MusenalmID }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}

View File

@@ -1,6 +1,24 @@
{{ if .series }}
{{ .series.Title }}
{{ $model := . }}
{{ $r := $model.series }}
<div class="flex flex-col font-serif mt-16">
<div class="grow-0 max-w-[48rem]">
<div>
{{ Safe .series.Annotation }}
<span class="font-bold">{{ $r.Title }}</span>
{{ if $r.References }}
<div class="text-sm font-sans px-2 py-1 ml-2 bg-stone-100 w-max inline-block">
{{ $r.References }}
</div>
{{ end }}
{{ end }}
</div>
{{ if $r.Annotation }}
<div class="max-w-[48rem]">
<span class="">{{ Safe $r.Annotation }}</span>
</div>
{{ end }}
<div class="">
{{ template "_reiherelations" (Arr $r $model.relations $model.entries true) }}
</div>
</div>
</div>

View File

@@ -1,29 +1,102 @@
{{ $model := . }}
<div id="pageheading" class="headingcontainer">
<div x-data="{ search : '{{ $model.search }}' }" :class="search ? 'searchfilter' : ''">
<div id="pageheading" class="headingcontainer">
<h1 class="heading">Bände nach Reihentiteln</h1>
<div class="flex flex-row justify-center ">
{{ if .letter }}
<div class="notifier" x-show="!search">
<i class="ri-sort-alphabet-asc"></i>
<span class="filtercategory">Alle Reihen</span> &middot;
<span class="">Anfangsbuchstabe <span class="filterterm">{{ .letter }}</span></span>
</div>
{{ end }}
<div class="notifier" x-show="search">
<i class="ri-search-line"></i>
<span class="filtercategory">Suche</span>
&middot; <span class="filterterm" x-text="search"></span>
</div>
{{ if .a }}
<div class="notifier" x-show="!search">
{{ if .a.CorporateBody }}
<i class="ri-team-line"></i>
<span class="filtercategory">Verlag, Druckerei oder Vertrieb</span> &middot;
{{ else }}
<i class="ri-user-line"></i>
<span class="filtercategory">Herausgeber:in</span> &middot;
{{ end }}
<span class="filterterm">{{ .a.Name }}</span>
</div>
{{ end }}
{{ if .p }}
<div class="notifier" x-show="!search">
<i class="ri-map-pin-line"></i>
<span class="filtercategory">Erscheinungsort</span> &middot;
<span class="filterterm">{{ .p.Name }}</span>
</div>
{{ end }}
{{ if .year }}
<div class="notifier" x-show="!search">
<i class="ri-calendar-line"></i>
<span class="filtercategory">Geltungsjahr</span> &middot;
<span class="filterterm">{{ .year }}</span>
</div>
{{ end }}
{{ if not .letter }}
<div class="notifier ml-2" x-show="!search">
<a href="/reihen" class="no-underline">
<i class="ri-arrow-left-long-line"></i> Alle Reihen anzeigen
</a>
</div>
{{ end }}
<div class="notifier ml-2" x-show="search">
<a href="/reihen" class="no-underline">
<i class="ri-arrow-left-long-line"></i> Alle Reihen anzeigen
</a>
</div>
</div>
{{ if not .search }}
<div class="mt-2">
{{ template "_alphabet" Dict "active" .letter "letters" .letters "search" .search }}
</div>
</div>
{{ else }}
<div class="mt-2 border-b border-zinc-300 w-full"></div>
{{ end }}
</div>
</div>
<div class="mt-6">
{{ if not .search }}
<div class="mt-8">
{{ template "_reihenfilter" . }}
</div>
</div>
{{ else }}
<div class="mt-8 w-full"></div>
{{ end }}
<div id="searchcontent" class="font-serif">
<div id="searchcontent" class="font-serif">
{{ if $model.search }}
<script type="module">
let elements = document.querySelectorAll('.reihen-text');
let mark_instance = new Mark(elements);
// INFO: we wait a little bit before marking, to settle everything
<script type="module">
let elements = document.querySelectorAll('.reihen-text');
let mark_instance = new Mark(elements);
// INFO: we wait a little bit before marking, to settle everything
setTimeout(() => {
mark_instance.mark('{{ $model.search }}', {
"seperateWordSearch": true,
});
}, 200);
</script>
</script>
{{ end }}
@@ -31,7 +104,7 @@ let mark_instance = new Mark(elements);
{{ if and .search .idseries }}
<div class="mb-1 max-w-[60rem] hyphens-auto">
{{ range $id, $r := .idseries }}
{{ template "_reihe" (Arr $model $r true false) }}
{{ template "_reihe" (Arr $r $model.entries $model.relations true false) }}
{{ end }}
</div>
{{ end }}
@@ -39,7 +112,7 @@ let mark_instance = new Mark(elements);
{{ if .series }}
<div class="mb-1 max-w-[60rem] hyphens-auto">
{{ range $id, $r := .series }}
{{ template "_reihe" (Arr $model $r false false) }}
{{ template "_reihe" (Arr $r $model.entries $model.relations false false) }}
{{ end }}
</div>
{{ end }}
@@ -56,12 +129,19 @@ let mark_instance = new Mark(elements);
Treffer in Reihentiteln &uarr;
</div>
{{ end }}
{{ if not (or .series .idseries) }}
<div class="border-b text-sm font-sans text-right pb-0.5">
Keine Treffer im Reihentitel
<i class="ri-forbid-line inline-bloc -mr-0.5"></i>
</div>
{{ end }}
<div class="border-t mb-1.5 text-sm font-sans text-right pt-0.5">
Treffer in allen Feldern (Anmerkungen, Verweisen etc.) &darr;
</div>
<div class="mb-1 max-w-[60rem] hyphens-auto">
{{ range $id, $r := .altseries }}
{{ template "_reihe" (Arr $model $r false true) }}
{{ template "_reihe" (Arr $r $model.entries $model.relations false true) }}
{{ end }}
</div>
{{ end }}
@@ -73,4 +153,5 @@ let mark_instance = new Mark(elements);
gefunden.
</div>
{{ end }}
</div>
</div>

View File

@@ -113,7 +113,7 @@
}
.headingcontainer {
@apply mt-10 border-r border-zinc-300 relative;
@apply mt-16 border-r border-zinc-300 relative;
}
.headingcontainer h1 {
@@ -123,4 +123,20 @@
.filter-list-list .filter-list-item[aria-current="page"] {
@apply border-l-4 border-zinc-300 font-bold;
}
.headingcontainer .notifier {
@apply bg-stone-100 text-center text-base px-2.5 py-1 font-sans rounded;
}
.headingcontainer .notifier i {
@apply inline-block pr-0.5;
}
.headingcontainer .notifier .filterterm {
@apply font-bold;
}
.headingcontainer .backbutton {
@apply ml-4 bg-stone-100 py-0.5 px-2.5 rounded font-sans text-base text-center;
}
}