added config variables for default community logo and user photo
This commit is contained in:
+2
-1
@@ -15,6 +15,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.erbosoft.com/amy/amsterdam/config"
|
||||
"git.erbosoft.com/amy/amsterdam/database"
|
||||
"git.erbosoft.com/amy/amsterdam/ui"
|
||||
"git.erbosoft.com/amy/amsterdam/util"
|
||||
@@ -69,7 +70,7 @@ func ShowCommunity(ctxt ui.AmContext) (string, any) {
|
||||
if ci.PhotoURL != nil && *ci.PhotoURL != "" {
|
||||
ctxt.VarMap().Set("logoURL", *ci.PhotoURL)
|
||||
} else {
|
||||
ctxt.VarMap().Set("logoURL", "/img/builtin/default-community.jpg")
|
||||
ctxt.VarMap().Set("logoURL", config.GlobalConfig.Site.DefaultCommunityLogo)
|
||||
}
|
||||
tz := prefs.Location()
|
||||
loc := prefs.Localizer()
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.erbosoft.com/amy/amsterdam/config"
|
||||
"git.erbosoft.com/amy/amsterdam/database"
|
||||
"git.erbosoft.com/amy/amsterdam/email"
|
||||
"git.erbosoft.com/amy/amsterdam/exports"
|
||||
@@ -108,7 +109,7 @@ func communityLogoURL(ci *database.ContactInfo) string {
|
||||
if ci.PhotoURL != nil && *ci.PhotoURL != "" {
|
||||
return *ci.PhotoURL
|
||||
}
|
||||
return "/img/builtin/default-community.jpg"
|
||||
return config.GlobalConfig.Site.DefaultCommunityLogo
|
||||
}
|
||||
|
||||
/* CommunityProfileForm displays the dfialog for editing the community profile.
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.erbosoft.com/amy/amsterdam/config"
|
||||
"git.erbosoft.com/amy/amsterdam/database"
|
||||
"git.erbosoft.com/amy/amsterdam/email"
|
||||
"git.erbosoft.com/amy/amsterdam/htmlcheck"
|
||||
@@ -440,7 +441,7 @@ func templateBozo(args jet.Arguments) reflect.Value {
|
||||
func templateProfileImage(args jet.Arguments) reflect.Value {
|
||||
post := args.Get(0).Convert(reflect.TypeFor[*database.PostHeader]()).Interface().(*database.PostHeader)
|
||||
ctxt := args.Get(1).Convert(reflect.TypeFor[ui.AmContext]()).Interface().(ui.AmContext)
|
||||
rc := "/img/builtin/no-user.png"
|
||||
rc := config.GlobalConfig.Site.DefaultUserPhoto
|
||||
user, err := post.Creator(ctxt.Ctx())
|
||||
if err == nil {
|
||||
ci, err := user.ContactInfo(ctxt.Ctx())
|
||||
|
||||
@@ -74,6 +74,8 @@ type AmConfig struct {
|
||||
UserAgreementResource string `yaml:"userAgreementResource"`
|
||||
PolicyResource string `yaml:"policyResource"`
|
||||
FooterTemplate string `yaml:"footerTemplate"`
|
||||
DefaultCommunityLogo string `yaml:"defaultCommunityLogo"`
|
||||
DefaultUserPhoto string `yaml:"defaultUserPhoto"`
|
||||
} `yaml:"site"`
|
||||
Database struct {
|
||||
Driver string `yaml:"driver"`
|
||||
|
||||
@@ -21,6 +21,8 @@ site:
|
||||
userAgreementResource: "useragreement.html"
|
||||
policyResource: "policy.html"
|
||||
footerTemplate: "footer.jet"
|
||||
defaultCommunityLogo: "/img/builtin/default-community.jpg"
|
||||
defaultUserPhoto: "/img/builtin/no-user.png"
|
||||
database:
|
||||
driver: "mysql"
|
||||
dsn: "amsdb:x00yes2k@tcp(localhost)/amsterdam?parseTime=true&loc=UTC"
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ func immediateIf(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"
|
||||
rc := config.GlobalConfig.Site.DefaultCommunityLogo
|
||||
comm := a.Get(0).Convert(reflect.TypeFor[*database.Community]()).Interface().(*database.Community)
|
||||
ctxt := a.Get(1).Convert(reflect.TypeFor[AmContext]()).Interface().(AmContext)
|
||||
ci, err := comm.ContactInfo(ctxt.Ctx())
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="flex-shrink-0 w-40">
|
||||
<div class="border-2 border-gray-300 rounded mb-4">
|
||||
<img src="{{ photoURL }}" alt="{{ username }}'s photo" class="w-full h-auto rounded-3xl border-2 border-gray-300"
|
||||
onerror="this.src='/img/builtin/no-user.png'">
|
||||
onerror="this.src='{{ GlobalConfig.Site.DefaultUserPhoto }}'">
|
||||
</div>
|
||||
<div class="text-xs text-gray-700 space-y-2">
|
||||
<div>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="flex-shrink-0">
|
||||
<img src="{{ post_profile_pic }}" alt="Profile image: {{ post_userName }}"
|
||||
class="w-16 h-16 rounded-lg border-2 border-gray-300"
|
||||
onerror="this.src='/img/builtin/no-user.png'">
|
||||
onerror="this.src='{{ GlobalConfig.Site.DefaultUserPhoto }}'">
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="flex-1">
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.erbosoft.com/amy/amsterdam/config"
|
||||
"git.erbosoft.com/amy/amsterdam/database"
|
||||
"git.erbosoft.com/amy/amsterdam/email"
|
||||
"git.erbosoft.com/amy/amsterdam/ui"
|
||||
@@ -32,7 +33,7 @@ func userPhotoURL(ci *database.ContactInfo) string {
|
||||
if ci.PhotoURL != nil && *ci.PhotoURL != "" {
|
||||
return *ci.PhotoURL
|
||||
}
|
||||
return "/img/builtin/no-user.png"
|
||||
return config.GlobalConfig.Site.DefaultUserPhoto
|
||||
}
|
||||
|
||||
/* EditProfileForm renders the Amsterdam profile editing form.
|
||||
|
||||
Reference in New Issue
Block a user