1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +00:00

Add ability to delete single wiki pages.

This commit is contained in:
Josh Frye
2016-03-03 17:06:50 -05:00
parent f6759a731a
commit 1ca171dbe9
6 changed files with 761 additions and 906 deletions

View File

@ -256,3 +256,21 @@ func EditWikiPost(ctx *middleware.Context, form auth.NewWikiForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(form.Title))
}
func DeleteWikiPagePost(ctx *middleware.Context, form auth.NewWikiForm) {
pageURL := ctx.Params(":page")
if len(pageURL) == 0 {
pageURL = "Home"
}
pageName := models.ToWikiPageName(pageURL)
if err := ctx.Repo.Repository.DeleteWikiPage(ctx.User, pageName); err != nil {
ctx.Handle(500, "DeleteWikiPage", err)
return
}
ctx.JSON(200, map[string]interface{}{
"redirect": ctx.Repo.RepoLink + "/wiki/",
})
}