Merge branch 'main' of github.com:Theodor-Springmann-Stiftung/musenalm

This commit is contained in:
Simon Martens
2025-03-18 11:27:27 +01:00
7 changed files with 41 additions and 20 deletions

View File

@@ -24,6 +24,7 @@ const (
PARAM_EXTENDED = "extended"
TEMPLATE_SUCHE = "/suche/"
PARAM_QUERY = "q"
PARAM_PLACEHOLDER = "p"
)
var availableTypes = []string{"baende", "beitraege"}
@@ -109,6 +110,7 @@ type Parameters struct {
Extended bool
Collection string
Query string
Placeholder string
}
func NewParameters(e *core.RequestEvent) (*Parameters, error) {
@@ -122,10 +124,17 @@ func NewParameters(e *core.RequestEvent) (*Parameters, error) {
extended = true
}
query := e.Request.URL.Query().Get(PARAM_QUERY)
placeholder := query
if query == "" {
placeholder = e.Request.URL.Query().Get(PARAM_PLACEHOLDER)
}
return &Parameters{
Collection: collection,
Extended: extended,
Query: e.Request.URL.Query().Get(PARAM_QUERY),
Query: query,
Placeholder: placeholder,
}, nil
}

View File

@@ -303,7 +303,7 @@ func (p SearchParameters) ToQueryParamsBaende() string {
}
func (p SearchParameters) IsBeitraegeSearch() bool {
return p.Collection == "beitraege" && (p.Query != "" || p.AlmString != "" || p.AnnotationsString != "" || p.PersonsString != "" || p.TitleString != "" || p.YearString != "" || p.EntryString != "" || p.IncipitString != "")
return p.Collection == "beitraege" && (p.Query != "" || p.TypeString != "" || p.AlmString != "" || p.AnnotationsString != "" || p.PersonsString != "" || p.TitleString != "" || p.YearString != "" || p.EntryString != "" || p.IncipitString != "")
}
func (p SearchParameters) IsBaendeSearch() bool {

View File

@@ -44,7 +44,7 @@
</div>
</div>
<div class="text-center mt-8 startlinks font-serif text-xl">
<a href="/redaktion/einfuehrung" class="">Einleitung</a>
<a href="/redaktion/einleitung" class="">Einleitung</a>
<div class="inline px-1">|</div>
<a href="/reihen" class="font-bold">Alle Bände<i class="ri-arrow-right-double-line"></i></a>
</div>

View File

@@ -26,6 +26,7 @@
type Parameters struct {
Query string
Collection string
Placeholder sting
Extended bool
}
type SearchResultBaende struct {

View File

@@ -15,13 +15,21 @@
>
-->
<a
{{ if $model.Placeholder -}}
href="/suche/baende?p={{ $model.Placeholder }}"
{{- else -}}
href="/suche/baende"
{{- end -}}
class="block no-underline text-xl"
{{ if eq $model.Collection "baende" }}aria-current="page"{{- end -}}
>Bänden</a
>
<a
{{ if $model.Placeholder -}}
href="/suche/beitraege?p={{ $model.Placeholder }}"
{{- else -}}
href="/suche/beitraege"
{{- end -}}
class="block no-underline text-xl"
{{ if eq $model.Collection "beitraege" }}aria-current="page"{{- end -}}
>Beiträgen</a

View File

@@ -7,7 +7,7 @@
<div class="flex flex-row justify-between gap-x-3 w-full">
<label for="q" class="hidden">Suchbegriffe</label>
<input
{{ if $q }}value="{{ $q }}"{{- end }}
value="{{ $parameters.Placeholder }}"
type="search"
name="q"
minlength="3"

View File

@@ -1,7 +1,10 @@
{{ $model := . }}
<div id="searchcontrol" class="container-normal">
<div
id="searchcontrol"
class="container-normal"
x-data="{ placeholder: '{{ $model.parameters.Placeholder }}'">
<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
@@ -18,13 +21,13 @@
>
-->
<a
href="/suche/baende"
:href="'/suche/baende/?p='+placeholder"
class="block no-underline"
{{ if eq $model.type "baende" }}aria-current="page"{{- end -}}
>Bänden</a
>
<a
href="/suche/beitraege"
:href="'/suche/beitraege/?p='+placeholder"
class="block no-underline"
{{ if eq $model.type "beitraege" }}aria-current="page"{{- end -}}
>Beiträgen</a