From cf6d4a59ed1d1aa788b18d352c4d61abc50bdf49 Mon Sep 17 00:00:00 2001 From: Simon Martens Date: Wed, 26 Feb 2025 16:06:29 +0100 Subject: [PATCH] Refactored Startpage --- .air.toml | 1 + dbmodels/entries.go | 148 --------- dbmodels/queries.go | 5 + dbmodels/seriesses.go | 246 +------------- pages/reihe.go | 14 +- pages/reihen.go | 133 ++++++-- pages/suche.go | 21 +- scratchpad.md | 10 +- views/routes/almanach/body.gohtml | 301 +++++++++--------- views/routes/reihe/body.gohtml | 20 +- views/routes/reihen/body.gohtml | 15 +- .../routes/reihen/components/alphabet.gohtml | 1 + views/routes/reihen/components/hero.gohtml | 22 +- views/routes/suche/baende/body.gohtml | 18 ++ views/transform/site.css | 2 +- 15 files changed, 354 insertions(+), 603 deletions(-) delete mode 100644 dbmodels/entries.go diff --git a/.air.toml b/.air.toml index a234689..1aed42b 100644 --- a/.air.toml +++ b/.air.toml @@ -8,6 +8,7 @@ full_bin = "./tmp/musenalm --dir ./pb_data serve" cmd = "go build -tags=dev,fts5,sqlite_icu -o ./tmp/musenalm ." delay = 400 exclude_dir = [ + "views/transform", "views/routes", "views/layouts", "views/assets", diff --git a/dbmodels/entries.go b/dbmodels/entries.go deleted file mode 100644 index 3df3890..0000000 --- a/dbmodels/entries.go +++ /dev/null @@ -1,148 +0,0 @@ -package dbmodels - -import ( - "strconv" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/core" -) - -type EntriesAgents map[string][]*REntriesAgents - -func EntriesForID(app core.App, query int) ([]*Entry, error) { - entries := []*Entry{} - err := app.RecordQuery(ENTRIES_TABLE). - Where(dbx.HashExp{MUSENALMID_FIELD: strconv.Itoa(query)}). - All(&entries) - if err != nil { - return nil, err - } - - return entries, nil -} - -func YearsForEntries(app core.App) ([]int, error) { - rec := []core.Record{} - err := app.RecordQuery(ENTRIES_TABLE). - Select(YEAR_FIELD + " AS id"). - Distinct(true). - OrderBy("id"). - All(&rec) - if err != nil { - return nil, err - } - - years := []int{} - for _, r := range rec { - years = append(years, r.GetInt("id")) - } - - return years, nil -} - -func EntriesForYear(app core.App, year int) ([]*Entry, error) { - entries := []*Entry{} - err := app.RecordQuery(ENTRIES_TABLE). - Where(dbx.HashExp{YEAR_FIELD: year}). - All(&entries) - if err != nil { - return nil, err - } - - return entries, nil -} - -func EntriesForAgent(app core.App, agentId string) ([]*Entry, EntriesAgents, error) { - relations := []*core.Record{} - err := app.RecordQuery(RelationTableName(ENTRIES_TABLE, AGENTS_TABLE)). - Where(dbx.HashExp{AGENTS_TABLE: agentId}). - All(&relations) - if err != nil { - return nil, nil, err - } - - app.ExpandRecords(relations, []string{ENTRIES_TABLE}, nil) - entries := []*Entry{} - for _, r := range relations { - record := r.ExpandedOne(ENTRIES_TABLE) - if record == nil { - continue - } - entries = append(entries, NewEntry(record)) - } - - agents := map[string][]*REntriesAgents{} - for _, r := range relations { - agent := NewREntriesAgents(r) - agents[agent.Entry()] = append(agents[agent.Entry()], agent) - } - - return entries, agents, nil -} - -func EntriesForPlace(app core.App, placeId string) ([]*Entry, error) { - entries := []*Entry{} - err := app.RecordQuery(ENTRIES_TABLE). - Where(dbx.Like(PLACES_TABLE, placeId).Match(true, true)). - All(&entries) - if err != nil { - return nil, err - } - - return entries, nil -} - -func EntryForId(app core.App, id string) (*Entry, error) { - entry := &Entry{} - err := app.RecordQuery(ENTRIES_TABLE). - Where(dbx.HashExp{ID_FIELD: id}). - One(entry) - if err != nil { - return nil, err - } - return entry, nil -} - -func EntriesForIds(app core.App, ids []any) ([]*Entry, error) { - entries := []*Entry{} - err := app.RecordQuery(ENTRIES_TABLE). - Where(dbx.HashExp{ID_FIELD: ids}). - All(&entries) - if err != nil { - return nil, err - } - return entries, nil -} - -func EntryForMusenalmID(app core.App, id string) (*Entry, error) { - entry := &Entry{} - err := app.RecordQuery(ENTRIES_TABLE). - Where(dbx.HashExp{MUSENALMID_FIELD: id}). - One(entry) - if err != nil { - return nil, err - } - return entry, nil -} - -func EntriesForContents(app core.App, contents []*Content) (map[string]*Entry, error) { - cids := []any{} - for _, c := range contents { - cids = append(cids, c.Entry()) - } - - entries := []*Entry{} - err := app.RecordQuery(ENTRIES_TABLE). - Where(dbx.HashExp{ID_FIELD: cids}). - All(&entries) - if err != nil { - return nil, err - } - - entriesMap := make(map[string]*Entry, len(entries)) - for _, e := range entries { - entriesMap[e.Id] = e - } - - return entriesMap, nil -} diff --git a/dbmodels/queries.go b/dbmodels/queries.go index 4f3d0fb..09dd068 100644 --- a/dbmodels/queries.go +++ b/dbmodels/queries.go @@ -103,6 +103,11 @@ func Series_IDs(app core.App, ids []any) ([]*Series, error) { return TableByIDs[[]*Series](app, SERIES_TABLE, ids) } +func Series_ID(app core.App, id string) (*Series, error) { + ret, err := TableByID[Series](app, SERIES_TABLE, id) + return &ret, err +} + func Places_IDs(app core.App, ids []any) ([]*Place, error) { return TableByIDs[[]*Place](app, PLACES_TABLE, ids) } diff --git a/dbmodels/seriesses.go b/dbmodels/seriesses.go index 704a334..759d736 100644 --- a/dbmodels/seriesses.go +++ b/dbmodels/seriesses.go @@ -1,7 +1,6 @@ package dbmodels import ( - "slices" "strings" "github.com/Theodor-Springmann-Stiftung/musenalm/helpers/datatypes" @@ -69,7 +68,7 @@ outer_loop: ids = append(ids, id.ID) } - altseries, err := SeriessesForIds(app, ids) + altseries, err := Series_IDs(app, ids) if err != nil { return nil, nil, err } @@ -99,246 +98,3 @@ func TitleSearchSeries(app core.App, query string) ([]*Series, error) { return series, nil } - -// INFO: expects a normalized query string -// Returns all ids that match the query -func FTS5SearchSeries(app core.App, query string) ([]*FTS5IDQueryResult, error) { - seriesids := []*FTS5IDQueryResult{} - q := NewFTS5Query(). - From(SERIES_TABLE). - SelectID() - - queries := strings.Split(query, " ") - for _, que := range queries { - que := datatypes.NormalizeString(que) - if len(que) >= 3 { - q.AndMatch([]string{SERIES_TITLE_FIELD, ANNOTATION_FIELD, REFERENCES_FIELD}, que) - } - } - - querystring := q.Query() - if querystring == "" { - return seriesids, nil - } - - err := app.DB().NewQuery(querystring).All(&seriesids) - if err != nil { - return nil, err - } - - return seriesids, nil -} - -func IDsForSeriesses(series []*Series) []any { - ids := []any{} - for _, s := range series { - ids = append(ids, s.Id) - } - return ids -} - -func makeMapForEnrySeries(relations []*REntriesSeries, entries map[string]*Entry) SeriesEntries { - m := map[string][]*REntriesSeries{} - for _, r := range relations { - m[r.Series()] = append(m[r.Series()], r) - } - - for _, rel := range m { - slices.SortFunc(rel, func(i, j *REntriesSeries) int { - ientry := entries[i.Entry()] - jentry := entries[j.Entry()] - return ientry.Year() - jentry.Year() - }) - } - - return m -} - -func EntriesForSeriesses(app core.App, series []*Series) ( - SeriesEntries, - map[string]*Entry, - error) { - ids := IDsForSeriesses(series) - relations := []*core.Record{} - - err := app.RecordQuery(RelationTableName(ENTRIES_TABLE, SERIES_TABLE)). - Where(dbx.HashExp{ - SERIES_TABLE: ids, - }). - All(&relations) - if err != nil { - return nil, nil, err - } - - app.ExpandRecords(relations, []string{ENTRIES_TABLE}, nil) - bmap := map[string]*Entry{} - for _, r := range relations { - record := r.ExpandedOne(ENTRIES_TABLE) - if record == nil { - continue - } - entry := NewEntry(record) - bmap[entry.Id] = entry - } - - smap := map[string][]*REntriesSeries{} - for _, r := range relations { - rel := NewREntriesSeries(r) - smap[rel.Series()] = append(smap[rel.Series()], rel) - } - - for _, rel := range smap { - slices.SortFunc(rel, func(i, j *REntriesSeries) int { - ientry := bmap[i.Entry()] - jentry := bmap[j.Entry()] - return ientry.Year() - jentry.Year() - }) - } - - return smap, bmap, nil -} - -func LettersForSeries(app core.App) ([]string, error) { - letters := []core.Record{} - ids := []string{} - - err := app.RecordQuery(SERIES_TABLE). - Select("upper(substr(" + SERIES_TITLE_FIELD + ", 1, 1)) AS id"). - Distinct(true). - All(&letters) - if err != nil { - return nil, err - } - - for _, l := range letters { - ids = append(ids, l.GetString("id")) - } - return ids, nil -} - -func AllAgentsForSeries(app core.App) ([]*Agent, error) { - rels := []*core.Record{} - // INFO: we could just fetch all relations here - err := app.RecordQuery(RelationTableName(ENTRIES_TABLE, AGENTS_TABLE)). - GroupBy(AGENTS_TABLE). - All(&rels) - if err != nil { - return nil, err - } - - app.ExpandRecords(rels, []string{AGENTS_TABLE}, nil) - agents := []*Agent{} - for _, r := range rels { - record := r.ExpandedOne(AGENTS_TABLE) - if record == nil { - continue - } - agent := NewAgent(record) - agents = append(agents, agent) - } - - SortAgentsByName(agents) - - return agents, err -} - -func SeriesForLetter(app core.App, letter string) ([]*Series, error) { - series := []*Series{} - err := app.RecordQuery(SERIES_TABLE). - Where(dbx.Like(SERIES_TITLE_FIELD, letter).Match(false, true)). - OrderBy(SERIES_TITLE_FIELD). - All(&series) - if err != nil { - return nil, err - } - - return series, nil -} - -func SeriesForAgent(app core.App, id string) ([]*Series, SeriesEntries, map[string]*Entry, error) { - entries, _, err := EntriesForAgent(app, id) - if err != nil { - return nil, nil, nil, err - } - - return SeriesForEntries(app, entries) -} - -func SeriesForPlace(app core.App, id string) ([]*Series, SeriesEntries, map[string]*Entry, error) { - entries, err := EntriesForPlace(app, id) - if err != nil { - return nil, nil, nil, err - } - - return SeriesForEntries(app, entries) -} - -func SeriesForEntries(app core.App, entries []*Entry) ([]*Series, SeriesEntries, map[string]*Entry, error) { - bids := make([]any, 0, len(entries)) - for _, e := range entries { - bids = append(bids, e.Id) - } - - srels := []*REntriesSeries{} - err := app.RecordQuery(RelationTableName(ENTRIES_TABLE, SERIES_TABLE)). - Where(dbx.HashExp{ENTRIES_TABLE: bids}). - All(&srels) - if err != nil { - return nil, nil, nil, err - } - - sids := []any{} - for _, s := range srels { - sids = append(sids, s.Series()) - } - - series := []*Series{} - err = app.RecordQuery(SERIES_TABLE). - Where(dbx.HashExp{ID_FIELD: sids}). - All(&series) - if err != nil { - return nil, nil, nil, err - } - - bmap := make(map[string]*Entry, len(entries)) - for _, e := range entries { - bmap[e.Id] = e - } - - smap := makeMapForEnrySeries(srels, bmap) - - return series, smap, bmap, nil -} - -func SeriesForYear(app core.App, year int) ([]*Series, SeriesEntries, map[string]*Entry, error) { - series, err := EntriesForYear(app, year) - if err != nil { - return nil, nil, nil, err - } - - return SeriesForEntries(app, series) -} - -func SeriesForId(app core.App, id string) (*Series, error) { - s := &Series{} - err := app.RecordQuery(SERIES_TABLE). - Where(dbx.HashExp{MUSENALMID_FIELD: id}). - One(s) - if err != nil { - return nil, err - } - - return s, nil -} - -func SeriessesForIds(app core.App, ids []any) ([]*Series, error) { - series := []*Series{} - err := app.RecordQuery(SERIES_TABLE). - Where(dbx.HashExp{ID_FIELD: ids}). - All(&series) - if err != nil { - return nil, err - } - - return series, nil -} diff --git a/pages/reihe.go b/pages/reihe.go index eadfe0a..f6f5b9e 100644 --- a/pages/reihe.go +++ b/pages/reihe.go @@ -35,17 +35,27 @@ func (p *ReihePage) Setup(router *router.Router[*core.RequestEvent], app core.Ap router.GET(URL_REIHE, func(e *core.RequestEvent) error { id := e.Request.PathValue("id") data := make(map[string]interface{}) - reihe, err := dbmodels.SeriesForId(app, id) + reihe, err := dbmodels.Series_ID(app, id) if err != nil { return engine.Response404(e, err, data) } data["series"] = reihe - rmap, emap, err := dbmodels.EntriesForSeriesses(app, []*dbmodels.Series{reihe}) + entries, relations, err := Entries_Series_IDs(app, []any{id}) if err != nil { return engine.Response404(e, err, data) } + emap := make(map[string]*dbmodels.Entry) + for _, entry := range entries { + emap[entry.Id] = entry + } + + rmap := make(map[string][]*dbmodels.REntriesSeries) + for _, relation := range relations { + rmap[relation.Series()] = append(rmap[relation.Series()], relation) + } + data["relations"] = rmap[reihe.Id] data["entries"] = emap diff --git a/pages/reihen.go b/pages/reihen.go index 77b04c3..7348434 100644 --- a/pages/reihen.go +++ b/pages/reihen.go @@ -2,6 +2,7 @@ package pages import ( "strconv" + "strings" "github.com/Theodor-Springmann-Stiftung/musenalm/app" "github.com/Theodor-Springmann-Stiftung/musenalm/dbmodels" @@ -150,6 +151,10 @@ func (p *ReihenPage) SearchRequest(app core.App, engine *templating.Engine, e *c func (p *ReihenPage) Get(request *core.RequestEvent, engine *templating.Engine, data map[string]interface{}) error { data["common"] = NewCommonReihenData(request.App) + record, _ := p.GetLatestData(request.App) + if record != nil { + data["record"] = pagemodels.NewReihen(record) + } return engine.Response200(request, URL_REIHEN, data) } @@ -278,15 +283,10 @@ func NewSeriesListResult_Letter(app core.App, letter string) (*SeriesListResult, entriesMap[e.Id] = e } - rmap, bmap, err := dbmodels.EntriesForSeriesses(app, series) - if err != nil { - return nil, err - } - return &SeriesListResult{ Series: series, - Entries: bmap, - EntriesSeries: rmap, + Entries: entriesMap, + EntriesSeries: relationsMap, }, nil } @@ -445,56 +445,121 @@ func NewSeriesResult_Search(app core.App, search string) (*SeriesListResult, err dbmodels.Sort_Series_Title(series) dbmodels.Sort_Series_Title(altseries) - rmap, bmap, err := dbmodels.EntriesForSeriesses(app, series) + keys := []any{} + keys = append(keys, dbmodels.Ids(series)...) + keys = append(keys, dbmodels.Ids(altseries)...) + + entries, relations, err := Entries_Series_IDs(app, keys) if err != nil { return nil, err } - rmap2, bmap2, err := dbmodels.EntriesForSeriesses(app, altseries) - if err != nil { - return nil, err + relationsMap := make(map[string][]*dbmodels.REntriesSeries) + entriesMap := make(map[string]*dbmodels.Entry) + for _, v := range relations { + relationsMap[v.Series()] = append(relationsMap[v.Series()], v) } - for k, v := range rmap2 { - rmap[k] = v - } - for k, v := range bmap2 { - bmap[k] = v + for _, v := range entries { + entriesMap[v.Id] = v } - ids := []*dbmodels.Series{} - if searchint, err := strconv.Atoi(search); err == nil { - identries, err := dbmodels.EntriesForID(app, searchint) + ret := &SeriesListResult{ + Series: series, + AltSeries: altseries, + Entries: entriesMap, + EntriesSeries: relationsMap, + } + + if _, err := strconv.Atoi(strings.TrimSpace(search)); err == nil { + identries := []*dbmodels.Entry{} + err := app.RecordQuery(dbmodels.ENTRIES_TABLE). + Where(dbx.HashExp{dbmodels.MUSENALMID_FIELD: search}). + All(&identries) if err != nil { return nil, err } if len(identries) != 0 { - - idseries, rmap3, bmap3, err := dbmodels.SeriesForEntries(app, identries) + app.Logger().Info("Found entries by musenalmid", "count", len(identries)) + idseries, idrelations, err := Series_Entries(app, identries) if err != nil { return nil, err } - ids = idseries - dbmodels.Sort_Series_Title(idseries) + ret.IDSeries = idseries - for k, v := range rmap3 { - rmap[k] = v + for _, v := range idrelations { + ret.EntriesSeries[v.Series()] = append(relationsMap[v.Series()], v) } - for k, v := range bmap3 { - bmap[k] = v + for _, v := range identries { + ret.Entries[v.Id] = v } } } - return &SeriesListResult{ - Series: series, - Entries: bmap, - EntriesSeries: rmap, - IDSeries: ids, - AltSeries: altseries, - }, nil + return ret, nil +} + +func (r *SeriesListResult) Count() int { + return len(r.Series) + len(r.AltSeries) + len(r.IDSeries) +} + +func Entries_Series(app core.App, series []*dbmodels.Series) ([]*dbmodels.Entry, []*dbmodels.REntriesSeries, error) { + relations, err := dbmodels.REntriesSeries_Seriess(app, dbmodels.Ids(series)) + if err != nil { + return nil, nil, err + } + + eids := []any{} + for _, r := range relations { + eids = append(eids, r.Entry()) + } + + entries, err := dbmodels.Entries_IDs(app, eids) + if err != nil { + return nil, nil, err + } + + return entries, relations, nil +} + +func Entries_Series_IDs(app core.App, ids []any) ([]*dbmodels.Entry, []*dbmodels.REntriesSeries, error) { + relations, err := dbmodels.REntriesSeries_Seriess(app, ids) + if err != nil { + return nil, nil, err + } + + eids := []any{} + for _, r := range relations { + eids = append(eids, r.Entry()) + } + + entries, err := dbmodels.Entries_IDs(app, eids) + if err != nil { + return nil, nil, err + } + + return entries, relations, nil +} + +func Series_Entries(app core.App, entries []*dbmodels.Entry) ([]*dbmodels.Series, []*dbmodels.REntriesSeries, error) { + relations, err := dbmodels.REntriesSeries_Entries(app, dbmodels.Ids(entries)) + if err != nil { + return nil, nil, err + } + + sids := []any{} + for _, r := range relations { + sids = append(sids, r.Series()) + } + + series, err := dbmodels.Series_IDs(app, sids) + if err != nil { + return nil, nil, err + } + + return series, relations, nil } diff --git a/pages/suche.go b/pages/suche.go index 136eee8..cd5c323 100644 --- a/pages/suche.go +++ b/pages/suche.go @@ -27,7 +27,7 @@ const ( TEMPLATE_SUCHE = "/suche/" ) -var availableTypes = []string{"reihen", "baende", "beitraege", "personen"} +var availableTypes = []string{"baende", "beitraege"} func init() { rp := &SuchePage{ @@ -72,7 +72,7 @@ func (p *SuchePage) SimpleSearchBaendeRequest(app core.App, engine *templating.E return engine.Response404(e, err, nil) } - query := dbmodels.NormalizeQuery(params.Query) + query := params.NormalizeQuery() if len(query) == 0 { engine.Response404(e, nil, nil) } @@ -165,6 +165,10 @@ func NewParameters(e *core.RequestEvent) (*Parameters, error) { }, nil } +func (p *Parameters) NormalizeQuery() []string { + return dbmodels.NormalizeQuery(p.Query) +} + type SimpleParameters struct { Parameters Annotations bool @@ -195,15 +199,18 @@ func NewSimpleParameters(e *core.RequestEvent, p Parameters) (*SimpleParameters, // TODO: sanity check here if any single field is selected return &SimpleParameters{ - Parameters: p, + Parameters: p, + // INFO: Common parameters Alm: alm, Title: title, - Series: series, Persons: persons, - Places: places, - Refs: refs, Annotations: annotations, - Year: year, + + // INFO: Baende parameters + Places: places, + Refs: refs, + Year: year, + Series: series, }, nil } diff --git a/scratchpad.md b/scratchpad.md index 57a1980..a76b6a5 100644 --- a/scratchpad.md +++ b/scratchpad.md @@ -37,27 +37,25 @@ Modelle umwandeln (zzt RecordProxy) - In der Almanach-Ansicht werden die Abkürzungen erklärt - In der Almanach- und Suchansicht werden Sammlungen abgehoben -- In der Almanach- und Suchansicht werden auch mehrere Bilder zu einem Eintrag angezeigt +- In der Almanach- und Suchansicht werden auch mehrere Bilder zu einem Eintrag angezeigt, falls vorhanden - In der Almanach- und Suchansicht kann nach Inhalten frei gefiltert werden, oder nach Typ -- Es gibt neue URLs, die fest verlinkt werden können für einzelne: +- Es gibt URLs, die fest verlinkt werden können für einzelne: - Personen - Reihen - Bände - Beiträge + - Alle Suchanfragen - Die Suche ist klar nach Typ unterteilt und insgesamt zuverlässiger -- Zusätzlich zur jetzigen Suchfunktion gibt es für jeden Typ noch eine Detailsuche +- Zusätzlich zur jetzigen Suchfunktion gibt es für Beiträge und Bände noch eine Detailsuche - Suchergebnisse können nach Typ, Person, Jahr gefiltert werden - Suchergebnisse könnnen nach Jahr und Band, nach Band und Jahr (nach Personen) sortiert werden -- Jede Suche hat eine eindeutige URL TODO danach: - Google-Suchoptimierung - Error Pages prüfen & error-Verhalten von HTMX -- Stimmigere Page-Abstraktion - Weißraum in den Antworten - Antworten komprimieren - Cache? -- Footer diff --git a/views/routes/almanach/body.gohtml b/views/routes/almanach/body.gohtml index 9047191..9761068 100644 --- a/views/routes/almanach/body.gohtml +++ b/views/routes/almanach/body.gohtml @@ -44,156 +44,164 @@ {{- end -}} -
-
-
-
Almanach-Nummer
-
{{ $model.result.Entry.MusenalmID }}
+
+
Almanach
+
+
- {{- if $model.result.Entry.PreferredTitle -}} -
-
Kurztitel
-
{{ $model.result.Entry.PreferredTitle }}
-
- {{- end -}} - {{- if $model.result.Entry.TitleStmt -}} -
-
Titel
-
{{ $model.result.Entry.TitleStmt }}
-
- {{- end -}} -
-
Jahr
-
- {{- if $model.result.Entry.Year -}} - {{ $model.result.Entry.Year }} - {{- else -}} - [keine Angabe] +
+
+
+
Almanach-Nummer
+
{{ $model.result.Entry.MusenalmID }}
+
+ {{- if $model.result.Entry.PreferredTitle -}} +
+
Kurztitel
+
{{ $model.result.Entry.PreferredTitle }}
+
+ {{- end -}} + {{- if $model.result.Entry.TitleStmt -}} +
+
Titel
+
{{ $model.result.Entry.TitleStmt }}
+
+ {{- end -}} +
+
Jahr
+
+ {{- if $model.result.Entry.Year -}} + {{ $model.result.Entry.Year }} + {{- else -}} + [keine Angabe] + {{- end -}} +
+
+ {{- if $model.result.Entry.ResponsibilityStmt -}} +
+
Herausgeberangabe
+
{{ $model.result.Entry.ResponsibilityStmt }}
+
+ {{- end -}} + {{- if $model.result.Entry.Extent -}} +
+
Umfang
+
+ +
+
+ {{- end -}} + {{- if $model.result.Entry.Language -}} +
+
Sprache
+
+ {{- range $i, $lang := $model.result.Entry.Language -}} + {{- if $i -}},{{- end -}} + {{- if eq $lang "ger" -}} + {{ $isGer = true }} + Deutsch + {{- else if eq $lang "eng" -}} + {{ $isEng = true }} + Englisch + {{- else if eq $lang "fre" -}} + {{ $isFra = true }} + Französisch + {{- else if eq $lang "ita" -}} + Italienisch + {{- else if eq $lang "lat" -}} + Latein + {{- else -}} + {{ $lang }} + {{- end -}} + {{- end -}} +
+
+ {{- end -}} + {{- if $model.result.Entry.References -}} +
+
Nachweise
+
+ {{- $model.result.Entry.References -}} +
+
+ {{- end -}} + {{- if $model.result.Series -}} +
+
Reihen
+
+ {{- range $i, $s := $model.result.Series -}} +
+ {{- $rel := index $model.result.EntriesSeries $s.Id -}} + {{- if $rel -}} + {{- if not (eq $rel.Type "Bevorzugter Reihentitel") -}} + + {{- if eq $rel.Type "Früherer Reihentitel" -}} + hat Titelauflage s.a. + {{- else if eq $rel.Type "Späterer Reihentitel" -}} + ist Titelauflage von, s.a. + {{- else if eq $rel.Type "In anderer Sprache" -}} + {{- if $isFra -}} + In deutscher Sprache s.a. + {{- else -}} + In französischer Sprache s.a. + {{- end -}} + {{- else if eq $rel.Type "Alternatives Titelblatt" -}} + alternatives Titelblatt, s.a. + {{- end -}} + + {{- end -}} + {{- end -}} + {{ $s.Title }} +
+ {{- end -}} +
+
+ {{- end -}} + {{- if $model.result.Places -}} +
+
Orte
+
+ {{- range $i, $p := $model.result.Places -}} + + {{- end -}} +
+
+ {{- end -}} + {{- if $model.result.EntriesAgents -}} +
+
Personen
+
+ {{- range $i, $r := $model.result.EntriesAgents -}} + {{- $a := index $model.result.Agents $r.Agent -}} + {{- if $a -}} +
+ + {{ $a.Name }} + + + {{- $r.Type -}} + +
+ {{- end -}} + {{- end -}} +
+
+ {{- end -}} + {{- if $model.result.Entry.Annotation -}} +
+
Anmerkungen
+
+ {{- Safe (ReplaceSlashParen $model.result.Entry.Annotation) -}} +
+
{{- end -}}
- {{- if $model.result.Entry.ResponsibilityStmt -}} -
-
Herausgeber
-
{{ $model.result.Entry.ResponsibilityStmt }}
-
- {{- end -}} - {{- if $model.result.Entry.Extent -}} -
-
Umfang
-
- -
-
- {{- end -}} - {{- if $model.result.Entry.Language -}} -
-
Sprache
-
- {{- range $i, $lang := $model.result.Entry.Language -}} - {{- if $i -}},{{- end -}} - {{- if eq $lang "ger" -}} - {{ $isGer = true }} - Deutsch - {{- else if eq $lang "eng" -}} - {{ $isEng = true }} - Englisch - {{- else if eq $lang "fre" -}} - {{ $isFra = true }} - Französisch - {{- else if eq $lang "ita" -}} - Italienisch - {{- else if eq $lang "lat" -}} - Latein - {{- else -}} - {{ $lang }} - {{- end -}} - {{- end -}} -
-
- {{- end -}} - {{- if $model.result.Entry.References -}} -
-
Nachweise
-
- {{- $model.result.Entry.References -}} -
-
- {{- end -}} - {{- if $model.result.Series -}} -
-
Reihen
-
- {{- range $i, $s := $model.result.Series -}} -
- {{- $rel := index $model.result.EntriesSeries $s.Id -}} - {{- if $rel -}} - {{- if not (eq $rel.Type "Bevorzugter Reihentitel") -}} - - {{- if eq $rel.Type "Früherer Reihentitel" -}} - hat Titelauflage s.a. - {{- else if eq $rel.Type "Späterer Reihentitel" -}} - ist Titelauflage von, s.a. - {{- else if eq $rel.Type "In anderer Sprache" -}} - {{- if $isFra -}} - In deutscher Sprache s.a. - {{- else -}} - In französischer Sprache s.a. - {{- end -}} - {{- else if eq $rel.Type "Alternatives Titelblatt" -}} - alternatives Titelblatt, s.a. - {{- end -}} - - {{- end -}} - {{- end -}} - {{ $s.Title }} -
- {{- end -}} -
-
- {{- end -}} - {{- if $model.result.Places -}} -
-
Orte
-
- {{- range $i, $p := $model.result.Places -}} - - {{- end -}} -
-
- {{- end -}} - {{- if $model.result.EntriesAgents -}} -
-
Personen
-
- {{- range $i, $r := $model.result.EntriesAgents -}} - {{- $a := index $model.result.Agents $r.Agent -}} - {{- if $a -}} -
- - {{ $a.Name }} - - - {{- $r.Type -}} - -
- {{- end -}} - {{- end -}} -
-
- {{- end -}} - {{- if $model.result.Entry.Annotation -}} -
-
Anmerkungen
-
- {{- Safe (ReplaceSlashParen $model.result.Entry.Annotation) -}} -
-
- {{- end -}}
@@ -207,3 +215,4 @@ } +
diff --git a/views/routes/reihe/body.gohtml b/views/routes/reihe/body.gohtml index 7635f5a..cb57fb4 100644 --- a/views/routes/reihe/body.gohtml +++ b/views/routes/reihe/body.gohtml @@ -18,7 +18,7 @@
- - - - - - + + + - + + + + */}} + Reihe
diff --git a/views/routes/reihen/body.gohtml b/views/routes/reihen/body.gohtml index 22a19ee..e89046d 100644 --- a/views/routes/reihen/body.gohtml +++ b/views/routes/reihen/body.gohtml @@ -23,7 +23,18 @@ // Only on place request Place *dbmodels.Place } - */}} + + // Parameters: + .letter + .search + .hidden + + .record + .record.Image(Path) + .record.Text + + .startpage +*/}} {{ $model := . }} {{ if and .startpage .record }} @@ -86,7 +97,7 @@
{{ end }} - {{ if .series }} + {{ if $model.result.Series }}
Treffer in Reihentiteln ↑
diff --git a/views/routes/reihen/components/alphabet.gohtml b/views/routes/reihen/components/alphabet.gohtml index 307072c..95e575a 100644 --- a/views/routes/reihen/components/alphabet.gohtml +++ b/views/routes/reihen/components/alphabet.gohtml @@ -37,6 +37,7 @@ 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 }} />
diff --git a/views/routes/reihen/components/hero.gohtml b/views/routes/reihen/components/hero.gohtml index d067099..892f0df 100644 --- a/views/routes/reihen/components/hero.gohtml +++ b/views/routes/reihen/components/hero.gohtml @@ -4,10 +4,26 @@ x-data="{ open: true }" x-show="open">
-
- {{ Safe $model.record.Text }} +
+
+ {{ Safe $model.record.Text }} + + +
+ Bitte beachten Sie, dass es sich hier noch um eine öffentliche Testversion + handelt. Über Rückmeldungen und Anregungen freuen wir uns [→ Kontakt] +
+
-
+
diff --git a/views/routes/suche/baende/body.gohtml b/views/routes/suche/baende/body.gohtml index 9dbe354..9fb4630 100644 --- a/views/routes/suche/baende/body.gohtml +++ b/views/routes/suche/baende/body.gohtml @@ -1,4 +1,22 @@ {{ $model := . }} +{{/* .parameters + type Parameters struct { + Extended bool + Collection string + Query string + } + type SimpleParameters struct { + Parameters + Annotations bool + Persons bool + Title bool + Alm bool + Series bool + Places bool + Refs bool + Year bool + } + */}}
diff --git a/views/transform/site.css b/views/transform/site.css index 446eda0..cd3fdee 100644 --- a/views/transform/site.css +++ b/views/transform/site.css @@ -349,7 +349,7 @@ } #entrydata .fieldlabel { - @apply font-bold text-base font-sans whitespace-nowrap min-w-48 grow-0 shrink-0 pt-0.5; + @apply font-bold font-serif text-base whitespace-nowrap min-w-48 grow-0 shrink-0 pt-0.5; } #entrydata .fieldvalue {