all repos — homestead @ 4bbbd38124322ce51bba65298c6143e0e6d1a746

Code for my website

refactor CalendarPage to match other template function signatures

Alan Pearce
commit

4bbbd38124322ce51bba65298c6143e0e6d1a746

parent

086f378195ddc1e3bce087196fcbda4e6d3ae6fd

2 files changed, 8 insertions(+), 12 deletions(-)

changed files
M domain/calendar/templates/calendar.godomain/calendar/templates/calendar.go
@@ -13,15 +13,15 @@ "alin.ovh/homestead/domain/calendar"
"alin.ovh/homestead/domain/web/templates" ) -func CalendarPage( - site templates.SiteSettings, - page templates.PageSettings, - cal calendar.Calendar, -) g.Node { - return templates.Layout(site, page, Calendar(site, cal)) +func CalendarPage(site templates.SiteSettings, cal *calendar.Calendar) g.Node { + return templates.Layout(site, templates.PageSettings{ + Title: "Calendar", + TitleAttrs: templates.Attrs{}, + BodyAttrs: templates.Attrs{}, + }, Calendar(site, cal)) } -func Calendar(site templates.SiteSettings, cal calendar.Calendar) g.Node { +func Calendar(site templates.SiteSettings, cal *calendar.Calendar) g.Node { past := true dates, err := cal.Availability(2) if err != nil {
M domain/web/mux.godomain/web/mux.go
@@ -78,11 +78,7 @@ }
func (website *Website) Calendar(w http.ResponseWriter, r *http.Request) ihttp.Error { analytics.WithCountKey(r, "Calendar") - err := calendar.CalendarPage(*website.siteSettings, templates.PageSettings{ - Title: "Calendar", - TitleAttrs: templates.Attrs{}, - BodyAttrs: templates.Attrs{}, - }, *website.calendar).Render(w) + err := calendar.CalendarPage(*website.siteSettings, website.calendar).Render(w) if err != nil { return ihttp.InternalServerError("could not render calendar page", err) }