added alpine ajax - started conversion of the proj

This commit is contained in:
Simon Martens
2025-05-28 23:14:01 +02:00
parent fb8ac1b723
commit 168a733af1
24 changed files with 1412 additions and 1451 deletions

View File

@@ -0,0 +1,31 @@
{{ $model := . }}
<!-- Data:
type AlmanachResult struct {
Entry *dbmodels.Entry
Places []*dbmodels.Place
Series []*dbmodels.Series
Contents []*dbmodels.Content
Agents map[string]*dbmodels.Agent // <- Key is agent id
EntriesSeries map[string]*dbmodels.REntriesSeries // <- Key is series id
EntriesAgents []*dbmodels.REntriesAgents
ContentsAgents map[string][]*dbmodels.RContentsAgents // <- Key is content id
Types []string
HasScans bool
}
-->
<div class="flex container-normal bg-slate-100 mx-auto !pt-36 px-8">
<div class="flex-col w-full">
{{ if $model.redirect_url }}
<a href="{{ $model.redirect_url }}" class="text-gray-700 hover:text-slate-950">
<i class="ri-arrow-left-s-line"></i> Zurück
</a>
{{ else }}
<a href="/" class="text-gray-700 hover:text-slate-950">
<i class="ri-arrow-left-s-line"></i> Startseite
</a>
{{ end }}
<h1 class="text-2xl self-baseline w-full my-6 font-bold text-slate-900">Almanach bearbeiten</h1>
</div>
</div>

View File

@@ -1,5 +1,11 @@
{{ $model := . }}
{{ $isPerson := and $model.filter (or (eq $model.filter "noorg") (eq $model.filter "musik") (eq
$model.filter "text") (eq $model.filter "graphik") (eq $model.filter "hrsg"))
}}
{{ $isOrg := and $model.filter (eq $model.filter "org") }}
<div class="ml-12 shrink-0 grow-0 mr-2.5">
<div class="min-w-[22.5rem] max-w-96 flex flex-row relative ml-auto">
@@ -7,20 +13,32 @@
<i class="ri-search-line"></i><i class="-ml-0.5 inline-block ri-arrow-right-s-line"></i>
</div>
<div class="pb-0 border-b-4 border-zinc-300 grow">
<input
class="px-1.5 font-serif placeholder:italic w-full"
type="search"
name="search"
value="{{ $model.search }}"
placeholder="Suchbegriff"
x-model="search"
hx-get=""
hx-trigger="input delay:1000ms, keyup[enter]"
hx-select="#searchresults"
hx-target="#searchresults"
hx-swap="outerHTML"
autocomplete="off"
{{ if $model.search }}disabled="true"{{ end }} />
<form
method="GET"
hx-boost="false"
x-target="searchresults"
role="search"
aria-label="Personensuche">
{{- if $model.filter -}}
<input type="hidden" name="filter" value="{{- $model.filter -}}" />
{{- end -}}
{{- if $model.letter -}}
<input type="hidden" name="letter" value="{{- $model.letter -}}" />
{{- end -}}
<input
value="{{ $model.search }}"
placeholder="Suchbegriff"
type="search"
name="search"
class="px-1.5 font-serif placeholder:italic w-full"
aria-label="Personensuche"
x-model="search"
autocomplete="off"
@input.debounce="$el.form.requestSubmit()"
@search="$el.form.requestSubmit()"
{{ if $model.search }}disabled="true"{{ end }} />
<button x-show="false">Suchen</button>
</form>
</div>
<div id="permalink" class="font-serif ml-3 min-w-7 pb-1">
{{- if not $model.search -}}

View File

@@ -47,11 +47,11 @@
<!-- INFO: 2. Header -->
<div id="pageheading" class="headingcontainer">
<h1 class="heading">Bände nach Reihentiteln</h1>
{{ template "notifier" . }}
{{ template "notifier" $model }}
{{ if not (or .search .hidden) }}
<div class="mt-2">
{{ template "alphabet" Dict "active" .letter "letters" $model.common.Letters "search" .search }}
{{ template "alphabet" $model }}
</div>
{{ else }}
<div class="mt-2 border-b w-full"></div>

View File

@@ -1,16 +1,16 @@
{{ $model := . }}
{{ if $model.letters }}
{{ if and $model.common $model.common.Letters }}
<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 }}
{{ range $id, $r := $model.common.Letters }}
<a
class="odd:bg-stone-100 even:bg-zinc-100 mr-1 border-zinc-300 border-x border-t [&>a[aria-current='page']]:font-bold
px-2 no-underline transition-all duration-75
{{ if not $model.active -}}inactive{{- end -}}"
{{ if not $model.letter -}}inactive{{- end -}}"
:class="search ? 'inactive' : 'active'"
href="?letter={{ $r }}"
{{ if eq $model.active $r }}aria-current="page"{{ end }}
{{ if eq $model.letter $r }}aria-current="page"{{ end }}
hx-indicator="body"
hx-select="main"
hx-target="main"
@@ -30,20 +30,37 @@
<i class="ri-search-line"></i><i class="-ml-0.5 inline-block ri-arrow-right-s-line"></i>
</div>
<div class="pb-0 border-b-4 border-zinc-300 grow">
<input
class="px-1.5 font-serif placeholder:italic w-full"
type="search"
name="search"
value="{{ $model.search }}"
placeholder="Almanach-Nr oder Suchbegriff"
x-model="search"
hx-get=""
hx-trigger="input changed delay=1500ms, keyup[key=='Enter']"
hx-select="#searchcontent"
hx-target="#searchcontent"
hx-swap="outerHTML"
autocomplete="off"
{{ if $model.search }}disabled="true"{{ end }} />
<form
method="GET"
hx-boost="false"
x-target="searchcontent"
role="search"
aria-label="Reihentitelsuche">
{{- if $model.letter -}}
<input type="hidden" name="letter" value="{{- $model.letter -}}" />
{{- end -}}
{{- if and $model.result $model.result.Agent -}}
<input type="hidden" name="agent" value="{{- $model.result.Agent.Id -}}" />
{{- end -}}
{{- if and $model.result $model.result.Place -}}
<input type="hidden" name="place" value="{{- $model.result.Place.Id -}}" />
{{- end -}}
{{- if $model.year -}}
<input type="hidden" name="year" value="{{- $model.year -}}" />
{{- end -}}
<input
class="px-1.5 font-serif placeholder:italic w-full"
type="search"
name="search"
value="{{ $model.search }}"
placeholder="Almanach-Nr oder Suchbegriff"
x-model="search"
@input.debounce="$el.form.requestSubmit()"
@search="$el.form.requestSubmit()"
autocomplete="off"
{{ if $model.search }}disabled="true"{{ end }} />
<button x-show="false">Suchen</button>
</form>
</div>
<div id="permalink" class="font-serif ml-3 min-w-7 pb-1">
{{- if not $model.search -}}