From fcbff708a527633e4e7c0c5f5d09f995bb735456 Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Sat, 18 Oct 2025 20:50:19 -0600 Subject: [PATCH] updated community left menu to reflect logo changes --- ui/templates.go | 14 ++++++++++++++ ui/views/menu_left_comm.jet | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ui/templates.go b/ui/templates.go index c414728..cd2ab04 100644 --- a/ui/templates.go +++ b/ui/templates.go @@ -207,6 +207,19 @@ func makeYearRange(a jet.Arguments) reflect.Value { } } +// extractCommunityLogo extracts a community logo URL from a community. +func extractCommunityLogo(a jet.Arguments) reflect.Value { + rc := "/img/builtin/default-community.jpg" + comm := a.Get(0).Convert(reflect.TypeFor[*database.Community]()).Interface().(*database.Community) + ci, err := comm.ContactInfo() + if err == nil { + if ci.PhotoURL != nil && *ci.PhotoURL != "" { + rc = *ci.PhotoURL + } + } + return reflect.ValueOf(rc) +} + // SetupTemplates is called to set up the template renderer after the configuration is loaded. func SetupTemplates() { views = jet.NewSet( @@ -222,6 +235,7 @@ func SetupTemplates() { views.AddGlobalFunc("GetMonthList", getMonthList) views.AddGlobalFunc("MakeIntRange", makeIntRange) views.AddGlobalFunc("MakeYearRange", makeYearRange) + views.AddGlobalFunc("ExtractCommunityLogo", extractCommunityLogo) views.AddGlobalFunc("GetCountryList", func(a jet.Arguments) reflect.Value { return reflect.ValueOf(internalGetCountryList()) diff --git a/ui/views/menu_left_comm.jet b/ui/views/menu_left_comm.jet index 8717c98..8e07a4d 100644 --- a/ui/views/menu_left_comm.jet +++ b/ui/views/menu_left_comm.jet @@ -10,8 +10,7 @@ {{ comm := .CurrentCommunity() }}
- {{ comm.Name }} + {{ comm.Name }}
{{ menu.Title }}
{{ ctxt := . }}