A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
add year
aichy126c2b1c60c5b2a
diff --git a/internal/controller/template_controller.go b/internal/controller/template_controller.goindex d54ddeb8..12c9a2a2 100644--- a/internal/controller/template_controller.go+++ b/internal/controller/template_controller.go@@ -1,9 +1,11 @@package controllerimport (+ "fmt""html/template""net/http""regexp"+ "time""github.com/answerdev/answer/internal/base/handler"templaterender "github.com/answerdev/answer/internal/controller/template_render"@@ -51,9 +53,9 @@ func GetStyle() (script, css string) {}return}-func (tc *TemplateController) SiteInfo(ctx *gin.Context) *schema.SiteInfoResp {+func (tc *TemplateController) SiteInfo(ctx *gin.Context) *schema.TemplateSiteInfoResp {var err error- resp := &schema.SiteInfoResp{}+ resp := &schema.TemplateSiteInfoResp{}resp.General, err = tc.siteInfoService.GetSiteGeneral(ctx)if err != nil {log.Error(err)@@ -67,6 +69,7 @@ func (tc *TemplateController) SiteInfo(ctx *gin.Context) *schema.SiteInfoResp {if err != nil {log.Error(err)}+ resp.Year = fmt.Sprintf("%d", time.Now().Year())return resp}@@ -99,6 +102,7 @@ func (tc *TemplateController) QuestionInfo(ctx *gin.Context) {"answerid": answerid,"scriptPath": tc.scriptPath,"cssPath": tc.cssPath,+ "siteinfo": tc.SiteInfo(ctx),})}@@ -114,6 +118,7 @@ func (tc *TemplateController) TagList(ctx *gin.Context) {"scriptPath": tc.scriptPath,"cssPath": tc.cssPath,"err": err.Error(),+ "siteinfo": tc.SiteInfo(ctx),})return}@@ -123,6 +128,7 @@ func (tc *TemplateController) TagList(ctx *gin.Context) {"cssPath": tc.cssPath,"page": page,"data": data,+ "siteinfo": tc.SiteInfo(ctx),})}@@ -138,6 +144,7 @@ func (tc *TemplateController) TagInfo(ctx *gin.Context) {"scriptPath": tc.scriptPath,"cssPath": tc.cssPath,"err": err.Error(),+ "siteinfo": tc.SiteInfo(ctx),})return}@@ -145,6 +152,7 @@ func (tc *TemplateController) TagInfo(ctx *gin.Context) {"tag": taginifo,"scriptPath": tc.scriptPath,"cssPath": tc.cssPath,+ "siteinfo": tc.SiteInfo(ctx),})}@@ -156,6 +164,7 @@ func (tc *TemplateController) UserInfo(ctx *gin.Context) {userinfo, err := tc.templateRenderController.UserInfo(ctx, req)if err != nil {ctx.HTML(http.StatusNotFound, "404.html", gin.H{+ "siteinfo": tc.SiteInfo(ctx),"scriptPath": tc.scriptPath,"cssPath": tc.cssPath,"err": err.Error(),@@ -163,6 +172,7 @@ func (tc *TemplateController) UserInfo(ctx *gin.Context) {return}ctx.HTML(http.StatusOK, "homepage.html", gin.H{+ "siteinfo": tc.SiteInfo(ctx),"userinfo": userinfo,"scriptPath": tc.scriptPath,"cssPath": tc.cssPath,@@ -172,6 +182,7 @@ func (tc *TemplateController) UserInfo(ctx *gin.Context) {func (tc *TemplateController) Page404(ctx *gin.Context) {ctx.HTML(http.StatusNotFound, "404.html", gin.H{+ "siteinfo": tc.SiteInfo(ctx),"scriptPath": tc.scriptPath,"cssPath": tc.cssPath,})diff --git a/internal/schema/siteinfo_schema.go b/internal/schema/siteinfo_schema.goindex 88c767e9..97fcc2d9 100644--- a/internal/schema/siteinfo_schema.go+++ b/internal/schema/siteinfo_schema.go@@ -95,6 +95,12 @@ type SiteInfoResp struct {Interface *SiteInterfaceResp `json:"interface"`Branding *SiteBrandingResp `json:"branding"`}+type TemplateSiteInfoResp struct {+ General *SiteGeneralResp `json:"general"`+ Interface *SiteInterfaceResp `json:"interface"`+ Branding *SiteBrandingResp `json:"branding"`+ Year string+}// UpdateSMTPConfigReq get smtp config requesttype UpdateSMTPConfigReq struct {diff --git a/ui/template/footer.html b/ui/template/footer.htmlindex 724e282d..45839a21 100644--- a/ui/template/footer.html+++ b/ui/template/footer.html@@ -5,8 +5,8 @@<div class="container"><p class="text-center mb-0 fs-14 text-secondary">Built on <a href="https://answer.dev/" target="_blank"> Answer </a>-- the open-source software that power Q&A communities<br />Made- with love © 2022 Answer+ the open-source software that power Q&A communities.<br />Made+ with love © {{.siteinfo.Year}} {{.siteinfo.General.Name}}.</p></div></footer>diff --git a/ui/template/header.html b/ui/template/header.htmlindex 1fa2f045..db2db8cc 100644--- a/ui/template/header.html+++ b/ui/template/header.html@@ -20,11 +20,9 @@<span class="navbar-toggler-icon"></span></button><div class="d-flex justify-content-between align-items-center nav-grow flex-nowrap">- <a class="lh-1 me-0 me-sm-3 navbar-brand" href="/"><img- class="d-none d-lg-block logo rounded-1 me-0"- src="https://answer.dev.segmentfault.com/uploads/branding/4Gud8KXBXA9.png" alt="" /><img- class="lg-none logo rounded-1 me-0"- src="https://answer.dev.segmentfault.com/uploads/branding/4GxqyBKy6hu.png" alt="" /></a>+ <a class="lh-1 me-0 me-sm-3 navbar-brand" href="/">+ {{.siteinfo.General.Name}}+ </a></div><div class="me-auto navbar-collapse collapse" id="navBarContent"><hr class="hr lg-none mb-2" style="margin-top: 12px" />