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