mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 17:25:32 +00:00
Single person page + reihen list
This commit is contained in:
@@ -48,7 +48,7 @@ func (p *AlmanachPage) Setup(router *router.Router[*core.RequestEvent], app core
|
||||
}
|
||||
|
||||
data["srelations"] = srelations
|
||||
data["series"] = s
|
||||
data["series"] = series
|
||||
|
||||
places, err := dbmodels.PlacesForEntry(app, entry)
|
||||
if err != nil {
|
||||
@@ -80,12 +80,27 @@ func (p *AlmanachPage) Setup(router *router.Router[*core.RequestEvent], app core
|
||||
}
|
||||
data["agents"] = agents
|
||||
|
||||
err = p.getAbbr(app, data)
|
||||
if err != nil {
|
||||
return engine.Response404(e, err, data)
|
||||
}
|
||||
|
||||
return p.Get(e, engine, data)
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *AlmanachPage) getAbbr(app core.App, data map[string]interface{}) error {
|
||||
abbrs, err := pagemodels.GetAbks(app)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
data["abbrs"] = abbrs
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *AlmanachPage) Get(request *core.RequestEvent, engine *templating.Engine, data map[string]interface{}) error {
|
||||
return engine.Response200(request, TEMPLATE_ALMANACH, data)
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ const (
|
||||
PARAM_PERSON = "agent"
|
||||
PARAM_PLACE = "place"
|
||||
PARAM_YEAR = "year"
|
||||
PARAM_HIDDEN = "hidden"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -65,6 +66,7 @@ func (p *ReihenPage) Setup(router *router.Router[*core.RequestEvent], app core.A
|
||||
func (p *ReihenPage) YearRequest(app core.App, engine *templating.Engine, e *core.RequestEvent) error {
|
||||
year := e.Request.URL.Query().Get(PARAM_YEAR)
|
||||
data := map[string]interface{}{}
|
||||
data[PARAM_HIDDEN] = e.Request.URL.Query().Get(PARAM_HIDDEN)
|
||||
data[PARAM_YEAR] = year
|
||||
|
||||
y, err := strconv.Atoi(year)
|
||||
@@ -86,6 +88,7 @@ func (p *ReihenPage) YearRequest(app core.App, engine *templating.Engine, e *cor
|
||||
func (p *ReihenPage) LetterRequest(app core.App, engine *templating.Engine, e *core.RequestEvent) error {
|
||||
letter := e.Request.URL.Query().Get(PARAM_LETTER)
|
||||
data := map[string]interface{}{}
|
||||
data[PARAM_HIDDEN] = e.Request.URL.Query().Get(PARAM_HIDDEN)
|
||||
if letter == "" {
|
||||
data["startpage"] = true
|
||||
letter = "A"
|
||||
@@ -114,6 +117,7 @@ func (p *ReihenPage) PersonRequest(app core.App, engine *templating.Engine, e *c
|
||||
person := e.Request.URL.Query().Get(PARAM_PERSON)
|
||||
data := map[string]interface{}{}
|
||||
data[PARAM_PERSON] = person
|
||||
data[PARAM_HIDDEN] = e.Request.URL.Query().Get(PARAM_HIDDEN)
|
||||
|
||||
agent, err := dbmodels.AgentForId(app, person)
|
||||
if err != nil {
|
||||
@@ -137,6 +141,7 @@ func (p *ReihenPage) PlaceRequest(app core.App, engine *templating.Engine, e *co
|
||||
place := e.Request.URL.Query().Get(PARAM_PLACE)
|
||||
data := map[string]interface{}{}
|
||||
data[PARAM_PLACE] = place
|
||||
data[PARAM_HIDDEN] = e.Request.URL.Query().Get(PARAM_HIDDEN)
|
||||
|
||||
pl, err := dbmodels.PlaceForId(app, place)
|
||||
if err != nil {
|
||||
@@ -160,6 +165,7 @@ func (p *ReihenPage) SearchRequest(app core.App, engine *templating.Engine, e *c
|
||||
search := e.Request.URL.Query().Get(PARAM_SEARCH)
|
||||
data := map[string]interface{}{}
|
||||
data[PARAM_SEARCH] = search
|
||||
|
||||
// INFO: normalization happens in the db query
|
||||
series, altseries, err := dbmodels.BasicSearchSeries(app, search)
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ type SuchePage struct {
|
||||
const (
|
||||
URL_SUCHE = "/suche/{type}"
|
||||
URL_SUCHE_ALT = "/suche/{$}"
|
||||
DEFAULT_SUCHE = "/suche/reihen"
|
||||
DEFAULT_SUCHE = "/suche/baende"
|
||||
PARAM_QUERY = "q"
|
||||
PARAM_EXTENDED = "extended"
|
||||
TEMPLATE_SUCHE = "/suche/"
|
||||
|
||||
Reference in New Issue
Block a user