mirror of https://gitee.com/answerdev/answer.git
update homepage
This commit is contained in:
parent
cae46c94cf
commit
972d11b0e5
|
@ -54,6 +54,12 @@ func NewHTTPServer(debug bool,
|
|||
cmsauthV1.Use(authUserMiddleware.CmsAuth())
|
||||
answerRouter.RegisterAnswerCmsAPIRouter(cmsauthV1)
|
||||
|
||||
r.SetFuncMap(template.FuncMap{
|
||||
"templateHTML": func(data string) template.HTML {
|
||||
return template.HTML(data)
|
||||
},
|
||||
})
|
||||
|
||||
dev := os.Getenv("DEVCODE")
|
||||
if dev != "" {
|
||||
r.LoadHTMLGlob("../../ui/template/*")
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
templaterender "github.com/answerdev/answer/internal/controller/template_render"
|
||||
"github.com/answerdev/answer/internal/schema"
|
||||
"github.com/answerdev/answer/ui"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
@ -84,7 +83,6 @@ func (tc *TemplateController) TagList(ctx *gin.Context) {
|
|||
return
|
||||
}
|
||||
page := templaterender.Paginator(req.Page, req.PageSize, data.Count)
|
||||
spew.Dump(page)
|
||||
ctx.HTML(http.StatusOK, "tags.html", gin.H{
|
||||
"scriptPath": tc.scriptPath,
|
||||
"cssPath": tc.cssPath,
|
||||
|
@ -96,8 +94,20 @@ func (tc *TemplateController) TagList(ctx *gin.Context) {
|
|||
// TagInfo taginfo
|
||||
func (tc *TemplateController) TagInfo(ctx *gin.Context) {
|
||||
tag := ctx.Param("tag")
|
||||
|
||||
req := &schema.GetTagInfoReq{}
|
||||
req.Name = tag
|
||||
taginifo, err := tc.templateRenderController.TagInfo(ctx, req)
|
||||
if err != nil {
|
||||
ctx.HTML(http.StatusOK, "404.html", gin.H{
|
||||
"scriptPath": tc.scriptPath,
|
||||
"cssPath": tc.cssPath,
|
||||
"err": err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
ctx.HTML(http.StatusOK, "tag-detail.html", gin.H{
|
||||
"tag": tag,
|
||||
"tag": taginifo,
|
||||
"scriptPath": tc.scriptPath,
|
||||
"cssPath": tc.cssPath,
|
||||
})
|
||||
|
|
|
@ -10,3 +10,8 @@ func (q *TemplateRenderController) TagList(ctx context.Context, req *schema.GetT
|
|||
resp, err = q.tagService.GetTagWithPage(ctx, req)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (q *TemplateRenderController) TagInfo(ctx context.Context, req *schema.GetTagInfoReq) (resp *schema.GetTagResp, err error) {
|
||||
resp, err = q.tagService.GetTagInfo(ctx, req)
|
||||
return resp, err
|
||||
}
|
||||
|
|
|
@ -25,7 +25,10 @@
|
|||
<strong class="fs-5">{{.userinfo.Info.QuestionCount}}</strong><span class="text-secondary"> questions</span>
|
||||
</div>
|
||||
</div>
|
||||
{{if .userinfo.Info.Website }}
|
||||
<div class="d-flex align-items-center"><i class="br bi-house-door-fill me-2"></i><a class="link-secondary" href="{{.userinfo.Info.Website}}">{{.userinfo.Info.Website}}</a></div>
|
||||
{{else}}
|
||||
{{end}}
|
||||
<div class="d-flex text-secondary"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -39,7 +42,11 @@
|
|||
<div class="col-xxl-7 col-lg-8 col-sm-12">
|
||||
<div>
|
||||
<h5 class="mb-3">About Me</h5>
|
||||
<div class="text-center py-5 mb-4">{{.bio}}</div>
|
||||
{{if .bio }}
|
||||
<div class="text-center mb-4">{{.bio}}</div>
|
||||
{{else}}
|
||||
<div class="text-center py-5 mb-4">// Hello, World !</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5 mt-lg-0 col-xxl-3 col-lg-4 col-sm-12">
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
<div class="col-xxl-7 col-lg-8 col-sm-12">
|
||||
<div class="tag-box mb-5">
|
||||
<h3 class="mb-3">
|
||||
<a class="link-dark" href="/tags/apple">Apple</a>
|
||||
<a class="link-dark" href="/tags/{{$.tag.SlugName}}">{{$.tag.SlugName}}</a>
|
||||
</h3>
|
||||
<p class="text-break">
|
||||
对外只有3001一个端口,群集内有负载策略会分发给不同实例1111
|
||||
{{templateHTML $.tag.ParsedText}}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<div class="mb-3 d-flex flex-wrap justify-content-between">
|
||||
<h5 class="fs-5 text-nowrap mb-3 mb-md-0">3 Questions</h5>
|
||||
<h5 class="fs-5 text-nowrap mb-3 mb-md-0">{{.tag.QuestionCount}} Questions</h5>
|
||||
</div>
|
||||
<div class="border-top border-bottom-0 list-group list-group-flush">
|
||||
<div class="border-bottom pt-3 pb-2 px-0 list-group-item">
|
||||
|
|
Loading…
Reference in New Issue