updated community left menu to reflect logo changes
This commit is contained in:
@@ -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.
|
// SetupTemplates is called to set up the template renderer after the configuration is loaded.
|
||||||
func SetupTemplates() {
|
func SetupTemplates() {
|
||||||
views = jet.NewSet(
|
views = jet.NewSet(
|
||||||
@@ -222,6 +235,7 @@ func SetupTemplates() {
|
|||||||
views.AddGlobalFunc("GetMonthList", getMonthList)
|
views.AddGlobalFunc("GetMonthList", getMonthList)
|
||||||
views.AddGlobalFunc("MakeIntRange", makeIntRange)
|
views.AddGlobalFunc("MakeIntRange", makeIntRange)
|
||||||
views.AddGlobalFunc("MakeYearRange", makeYearRange)
|
views.AddGlobalFunc("MakeYearRange", makeYearRange)
|
||||||
|
views.AddGlobalFunc("ExtractCommunityLogo", extractCommunityLogo)
|
||||||
|
|
||||||
views.AddGlobalFunc("GetCountryList", func(a jet.Arguments) reflect.Value {
|
views.AddGlobalFunc("GetCountryList", func(a jet.Arguments) reflect.Value {
|
||||||
return reflect.ValueOf(internalGetCountryList())
|
return reflect.ValueOf(internalGetCountryList())
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
{{ comm := .CurrentCommunity() }}
|
{{ comm := .CurrentCommunity() }}
|
||||||
<div class="mb-2 mt-2">
|
<div class="mb-2 mt-2">
|
||||||
<div class="mb-1">
|
<div class="mb-1">
|
||||||
<img src="/img/builtin/default-community.jpg"
|
<img src="{{ ExtractCommunityLogo(comm) }}" alt="{{ comm.Name }}" class="w-28 h-16 rounded">
|
||||||
alt="{{ comm.Name }}" class="w-28 h-16 rounded">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="font-bold mb-1">{{ menu.Title }}</div>
|
<div class="font-bold mb-1">{{ menu.Title }}</div>
|
||||||
{{ ctxt := . }}
|
{{ ctxt := . }}
|
||||||
|
|||||||
Reference in New Issue
Block a user