Browse Source

Оформлена информация 'О себе' на карте пользователей #14

repo_rename
parent
commit
86f641fd9d
  1. 19
      routers/web/map/umap.go
  2. 2
      templates/map/umap.tmpl

19
routers/web/map/umap.go

@ -15,6 +15,9 @@ import (
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/markup/markdown"
)
const (
@ -76,6 +79,22 @@ func RenderUserSearch(ctx *context.Context, opts *user_model.SearchUserOptions,
}
}
for i := range users {
if len(users[i].Description) != 0 {
content, err := markdown.RenderString(&markup.RenderContext{
URLPrefix: ctx.Repo.RepoLink,
Metas: map[string]string{"mode": "document"},
GitRepo: ctx.Repo.GitRepo,
Ctx: ctx,
}, users[i].Description)
if err != nil {
ctx.ServerError("RenderString", err)
return
}
users[i].Description = content
}
}
ctx.Data["Keyword"] = opts.Keyword
ctx.Data["Total"] = count
ctx.Data["Users"] = users

2
templates/map/umap.tmpl

@ -2822,7 +2822,7 @@
{{range .Users}}
{{if .LocationCoordinate}}
[parseFloat({{.LocationCoordinate}}.split(',')[0]) , parseFloat({{.LocationCoordinate}}.split(',')[1]), "{{avatar .}} {{.HomeLink}} {{.FullName}} {{.Description}}"],
[parseFloat({{.LocationCoordinate}}.split(',')[0]) , parseFloat({{.LocationCoordinate}}.split(',')[1]), "{{avatar .}} {{.HomeLink}} {{.FullName}} <li> <div class=\"render-content markup\"> {{.Description | Str2html}} </div> </li>"],
{{end}}
{{else}}

Loading…
Cancel
Save