mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 17:25:32 +00:00
Personen Verbesserungen
This commit is contained in:
@@ -165,7 +165,7 @@ func LettersForAgents(app core.App, filter string) ([]string, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if filter == "autor" {
|
||||
} else if filter == "text" {
|
||||
err := app.RecordQuery(AGENTS_TABLE).
|
||||
Select("upper(substr(" + AGENTS_NAME_FIELD + ", 1, 1)) AS id").
|
||||
Distinct(true).
|
||||
|
||||
@@ -3,6 +3,9 @@ package functions
|
||||
import (
|
||||
"html/template"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
func Safe(s string) template.HTML {
|
||||
@@ -15,3 +18,20 @@ func Safe(s string) template.HTML {
|
||||
func ReplaceSlashParen(s string) string {
|
||||
return strings.ReplaceAll(s, "/)", "<p>")
|
||||
}
|
||||
|
||||
func Lower(s string) string {
|
||||
return cases.Lower(language.German).String(s)
|
||||
}
|
||||
|
||||
func Upper(s string) string {
|
||||
return cases.Upper(language.German).String(s)
|
||||
}
|
||||
|
||||
func First(s string) string {
|
||||
r := []rune(s)
|
||||
if len(r) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
return string(r[0])
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ func (p *PersonenPage) FilterRequest(app core.App, engine *templating.Engine, e
|
||||
agents, err = dbmodels.AgentsForProfession(app, "Musik", letter)
|
||||
}
|
||||
|
||||
if filter == "autor" {
|
||||
if filter == "text" {
|
||||
agents, err = dbmodels.AgentsForProfession(app, "Text", letter)
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@ func (e *Engine) funcs() error {
|
||||
e.AddFunc("Len", functions.Length)
|
||||
|
||||
// String Functions
|
||||
e.AddFunc("Lower", functions.Lower)
|
||||
e.AddFunc("Upper", functions.Upper)
|
||||
e.AddFunc("First", functions.First)
|
||||
e.AddFunc("ReplaceSlashParen", functions.ReplaceSlashParen)
|
||||
|
||||
// Time & Date Functions
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -50,6 +50,22 @@
|
||||
|
||||
|
||||
<scroll-button></scroll-button>
|
||||
|
||||
{{ block "scripts" . }}
|
||||
<!-- Default scripts... -->
|
||||
{{ end }}
|
||||
|
||||
|
||||
<script type="module">
|
||||
const hash = window.location.hash;
|
||||
if (hash) {
|
||||
const stripped = hash.slice(1);
|
||||
const element = document.getElementById(stripped);
|
||||
if (element) {
|
||||
element.setAttribute("aria-current", "location");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -43,6 +43,12 @@
|
||||
</div>
|
||||
{{ end }}
|
||||
<h1 class="text-3xl font-bold">{{ $model.result.Agent.Name }}</h1>
|
||||
{{- if $model.result.Agent.Pseudonyms -}}
|
||||
<p class="italic">
|
||||
auch:
|
||||
<span class="">{{ $model.result.Agent.Pseudonyms }}</span>
|
||||
</p>
|
||||
{{- end -}}
|
||||
<div>
|
||||
<span class="">
|
||||
{{ $model.result.Agent.BiographicalData }}
|
||||
@@ -51,10 +57,12 @@
|
||||
{{- $arr := $model.result.Agent.ProfessionArray -}}
|
||||
{{- if $arr -}}
|
||||
{{- range $i, $p := $arr -}}
|
||||
<div
|
||||
class="inline-block align-middle bg-slate-200 px-2 font-sans text-sm py-0.5 rounded mx-1">
|
||||
<a
|
||||
href="/personen/?letter={{- Upper (First $model.result.Agent.Name) -}}&filter={{ Lower $p }}#{{- $model.result.Agent.Id -}}"
|
||||
class="inline-block align-middle bg-slate-200 px-2 font-sans text-sm py-0.5 rounded mx-1
|
||||
hover:text-slate-900 no-underline">
|
||||
{{- $p -}}
|
||||
</div>
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</span>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<div id="personheader" class="border-t border-r border-zinc-300 relative w-full">
|
||||
{{ template "heading" . }}
|
||||
<div class="flex flex-row justify-end mt-12 items-end">
|
||||
{{ template "notifier" . }}
|
||||
{{ template "notifier" . }}
|
||||
{{ template "professionselectbox" . }}
|
||||
{{ template "searchbox" . }}
|
||||
</div>
|
||||
@@ -29,8 +29,10 @@
|
||||
{{ if .agents }}
|
||||
<div class="w-full flex flex-col">
|
||||
{{ range $count, $agent := .agents }}
|
||||
<div class="flex flex-row odd:bg-stone-100 even:bg-stone-50 px-3 py-0.5">
|
||||
<div class="grow">
|
||||
<div
|
||||
class="flex flex-row odd:bg-stone-100 even:bg-stone-50 px-3 py-0.5"
|
||||
id="personlist">
|
||||
<div class="grow" id="{{- $agent.Id -}}">
|
||||
<a href="/person/{{ $agent.Id }}" class="search-result font-bold">
|
||||
{{ $agent.Name }}
|
||||
</a>
|
||||
@@ -61,11 +63,12 @@
|
||||
{{- $parr := $agent.ProfessionArray -}}
|
||||
{{- if $parr -}}
|
||||
{{- range $i, $p := $parr -}}
|
||||
<div
|
||||
class="inline-block px-2 py-0.5 text-sm font-sans
|
||||
bg-slate-200 rounded ml-2">
|
||||
<a
|
||||
href="/personen/?letter={{- Upper (First $agent.Name) -}}&filter={{ Lower $p }}"
|
||||
class="inline-block px-2 py-0.5 text-sm font-sans no-underline
|
||||
hover:text-slate-950 bg-slate-200 rounded ml-2">
|
||||
{{ $p }}
|
||||
</div>
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -79,8 +82,6 @@
|
||||
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if .altagents }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<p>Keine Personen gefunden.</p>
|
||||
{{ end }}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{{ $model := . }}
|
||||
|
||||
{{ $isPerson := and $model.filter (or (eq $model.filter "noorg") (eq $model.filter "musik") (eq $model.filter "autor") (eq $model.filter "graphik") (eq $model.filter "hrsg")) }}
|
||||
{{ $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"))
|
||||
}}
|
||||
|
||||
{{ $isNoOrg := and $model.filter (eq $model.filter "noorg") }}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{{ $model := . }}
|
||||
|
||||
{{ $isPerson := and $model.filter (or (eq $model.filter "noorg") (eq $model.filter "musik") (eq $model.filter "autor") (eq $model.filter "graphik") (eq $model.filter "hrsg")) }}
|
||||
{{ $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") }}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{ $model := . }}
|
||||
|
||||
{{ $isPerson := and $model.filter (or (eq $model.filter "noorg") (eq $model.filter "musik") (eq $model.filter "autor") (eq $model.filter "graphik") (eq $model.filter "hrsg")) }}
|
||||
{{ $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")) }}
|
||||
|
||||
{{ $isProfession := and $model.filter (or (eq $model.filter "musik") (eq $model.filter "autor") (eq $model.filter "graphik") (eq $model.filter "hrsg")) }}
|
||||
{{ $isProfession := and $model.filter (or (eq $model.filter "musik") (eq $model.filter "text") (eq $model.filter "graphik") (eq $model.filter "hrsg")) }}
|
||||
|
||||
{{ $isNoOrg := and $model.filter (eq $model.filter "noorg") }}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
{{ $isMusik := and $model.filter (eq $model.filter "musik") }}
|
||||
|
||||
{{ $isAutor := and $model.filter (eq $model.filter "autor") }}
|
||||
{{ $isAutor := and $model.filter (eq $model.filter "text") }}
|
||||
|
||||
{{ $isGraphik := and $model.filter (eq $model.filter "graphik") }}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{{ $model := . }}
|
||||
|
||||
{{ $isPerson := and $model.filter (or (eq $model.filter "noorg") (eq $model.filter "musik") (eq $model.filter "autor") (eq $model.filter "graphik") (eq $model.filter "hrsg")) }}
|
||||
{{ $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"))
|
||||
}}
|
||||
|
||||
{{ $isNoOrg := and $model.filter (eq $model.filter "noorg") }}
|
||||
|
||||
@@ -8,7 +10,7 @@
|
||||
|
||||
{{ $isMusik := and $model.filter (eq $model.filter "musik") }}
|
||||
|
||||
{{ $isAutor := and $model.filter (eq $model.filter "autor") }}
|
||||
{{ $isAutor := and $model.filter (eq $model.filter "text") }}
|
||||
|
||||
{{ $isGraphik := and $model.filter (eq $model.filter "graphik") }}
|
||||
|
||||
@@ -32,7 +34,7 @@
|
||||
hx-target="main">
|
||||
<option value="noorg" {{ if $isNoOrg }}selected{{ end }}>Alle</option>
|
||||
<option value="musik" {{ if $isMusik }}selected{{ end }}>Musiker:innen</option>
|
||||
<option value="autor" {{ if $isAutor }}selected{{ end }}>Autor:innen</option>
|
||||
<option value="text" {{ if $isAutor }}selected{{ end }}>Autor:innen</option>
|
||||
<option value="graphik" {{ if $isGraphik }}selected{{ end }}>Graphiker:innen</option>
|
||||
<option value="hrsg" {{ if $isHrsg }}selected{{ end }}>Herausgeber:innen</option>
|
||||
</select>
|
||||
|
||||
@@ -340,6 +340,10 @@
|
||||
@apply text-gray-400;
|
||||
}
|
||||
|
||||
#personlist [aria-current="location"] a {
|
||||
@apply !text-red-700;
|
||||
}
|
||||
|
||||
#entrydata .fieldlabel {
|
||||
@apply font-bold text-base font-sans whitespace-nowrap min-w-48 grow-0 shrink-0 pt-0.5;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user