diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/wiki.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go index 8032d1a591..b21143cdae 100644 --- a/routers/repo/wiki.go +++ b/routers/repo/wiki.go @@ -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/", + }) +} |