= $.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 () {
$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);
+ }
+ });
+};