X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=js%2FeditPage.js;h=959d0889c72d5310df4c3fd3b68404331d099f7c;hb=044a917ed3908780479b759ac772e1545616c7fc;hp=a8869fb91b6b01552be1b2341873e92475c24654;hpb=bf15724655b75bf1b8f0fdabb111c158a91680a8;p=Rakka.git diff --git a/js/editPage.js b/js/editPage.js index a8869fb..959d088 100644 --- a/js/editPage.js +++ b/js/editPage.js @@ -153,7 +153,9 @@ Rakka.displayPageEditor = function (pageName, oldRevision, defaultType, source) = $.INPUT({type: "button", value: "Delete this page"}); $(btnDelete).click(function () { - throw new Error("FIXME: not implemented yet"); + if (window.confirm("Do you really want to delete this page?")) { + Rakka.deletePage(pageName); + } }); var updateTRContent = function () { @@ -440,4 +442,21 @@ Rakka.submitRedirection = function (pageName, oldRevision, givenPageName, destin $area.text("Error: " + req.status + " " + req.statusText); } }); -}; \ No newline at end of file +}; + +Rakka.deletePage = function (pageName) { + var url = Rakka.baseURI + encodeURI(pageName); + $.ajax({ + type : "DELETE", + url : url, + success : function () { + window.location.replace(url); + }, + error : function (req) { + Rakka.hideWaitingMessage(); + + var $area = Rakka.switchScreen(); + $area.text("Error: " + req.status + " " + req.statusText); + } + }); +};