caldav: add page titles to all routes
This commit is contained in:
parent
a892251387
commit
1e109b7ac3
1 changed files with 7 additions and 3 deletions
|
@ -139,7 +139,8 @@ func registerRoutes(p *alps.GoPlugin, u *url.URL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.Render(http.StatusOK, "calendar.html", &CalendarRenderData{
|
return ctx.Render(http.StatusOK, "calendar.html", &CalendarRenderData{
|
||||||
BaseRenderData: *alps.NewBaseRenderData(ctx),
|
BaseRenderData: *alps.NewBaseRenderData(ctx).
|
||||||
|
WithTitle(calendar.Name + " Calendar: " + start.Format("January 2006")),
|
||||||
Time: start,
|
Time: start,
|
||||||
Now: time.Now(), // TODO: Use client time zone
|
Now: time.Now(), // TODO: Use client time zone
|
||||||
Calendar: calendar,
|
Calendar: calendar,
|
||||||
|
@ -219,9 +220,10 @@ func registerRoutes(p *alps.GoPlugin, u *url.URL) {
|
||||||
return fmt.Errorf("expected exactly one calendar object with path %q, got %v", path, len(events))
|
return fmt.Errorf("expected exactly one calendar object with path %q, got %v", path, len(events))
|
||||||
}
|
}
|
||||||
event := &events[0]
|
event := &events[0]
|
||||||
|
summary, _ := event.Data.Events()[0].Props.Text("SUMMARY")
|
||||||
|
|
||||||
return ctx.Render(http.StatusOK, "event.html", &EventRenderData{
|
return ctx.Render(http.StatusOK, "event.html", &EventRenderData{
|
||||||
BaseRenderData: *alps.NewBaseRenderData(ctx),
|
BaseRenderData: *alps.NewBaseRenderData(ctx).WithTitle(summary),
|
||||||
Calendar: calendar,
|
Calendar: calendar,
|
||||||
Event: CalendarObject{event},
|
Event: CalendarObject{event},
|
||||||
})
|
})
|
||||||
|
@ -312,8 +314,10 @@ func registerRoutes(p *alps.GoPlugin, u *url.URL) {
|
||||||
return ctx.Redirect(http.StatusFound, CalendarObject{co}.URL())
|
return ctx.Redirect(http.StatusFound, CalendarObject{co}.URL())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
summary, _ := event.Props.Text("SUMMARY")
|
||||||
|
|
||||||
return ctx.Render(http.StatusOK, "update-event.html", &UpdateEventRenderData{
|
return ctx.Render(http.StatusOK, "update-event.html", &UpdateEventRenderData{
|
||||||
BaseRenderData: *alps.NewBaseRenderData(ctx),
|
BaseRenderData: *alps.NewBaseRenderData(ctx).WithTitle("Update " + summary),
|
||||||
Calendar: calendar,
|
Calendar: calendar,
|
||||||
CalendarObject: co,
|
CalendarObject: co,
|
||||||
Event: event,
|
Event: event,
|
||||||
|
|
Loading…
Reference in a new issue