diff options
author | Josh Frye <joshfng@gmail.com> | 2016-03-03 17:06:50 -0500 |
---|---|---|
committer | Josh Frye <joshfng@gmail.com> | 2016-03-04 09:26:52 -0500 |
commit | 1ca171dbe9a06d9c269b90b442fda63e36a418a8 (patch) | |
tree | e36e705885918d60a34318c86b2fa31ada27a3e7 /routers | |
parent | f6759a731a063d5d2be8a932f8d1e1a784cc0528 (diff) | |
download | gitea-1ca171dbe9a06d9c269b90b442fda63e36a418a8.tar.gz gitea-1ca171dbe9a06d9c269b90b442fda63e36a418a8.zip |
Add ability to delete single wiki pages.
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/", + }) +} |