|
|
|
package repo
|
|
|
|
|
|
|
|
import (
|
|
|
|
"code.gitea.io/gitea/modules/base"
|
|
|
|
"code.gitea.io/gitea/modules/context"
|
|
|
|
"code.gitea.io/gitea/services/trust_props"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
tplCompetences base.TplName = "repo/competences/list"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Competences(ctx *context.Context) {
|
|
|
|
ctx.Data["PageIsCompetences"] = true
|
|
|
|
repo := ctx.Data["Repository"]
|
|
|
|
|
|
|
|
var err error
|
|
|
|
ctx.Data["RenderedCompetences"], ctx.Data["TransformedTrustProps"], err = GetRenderedTrustPropsWithSearchLinks(ctx, repo, "Competences")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
ctx.ServerError("Render", err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx.HTML(http.StatusOK, tplCompetences)
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToggleCompetences(ctx *context.Context) {
|
|
|
|
if !ctx.IsSigned {
|
|
|
|
ctx.Error(http.StatusForbidden)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
toggledContent, err := trust_props.SaveRepoAndRenderContent(ctx, "competences")
|
|
|
|
if err != nil {
|
|
|
|
ctx.ServerError("ToggleCompetences", err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
responseBody := map[string]interface{}{
|
|
|
|
"content": toggledContent,
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx.JSON(
|
|
|
|
http.StatusOK,
|
|
|
|
responseBody,
|
|
|
|
)
|
|
|
|
}
|