Get delete page feature working
This commit is contained in:
parent
4ef08cc988
commit
4e4cdf6348
6 changed files with 43 additions and 5 deletions
|
@ -58,10 +58,31 @@ $(function(){
|
|||
});
|
||||
|
||||
$("#delete-page-btn").click(function() {
|
||||
bootbox.alert("Not Done Yet! Sorry");
|
||||
bootbox.confirm('Are you sure you want to delete this page?', function(result) {
|
||||
if (result) {
|
||||
deletePage();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var deletePage = function() {
|
||||
var pageName = $page_name.val();
|
||||
var path = Config['RELATIVE_PATH'] + '/' + pageName;
|
||||
|
||||
$.ajax({
|
||||
type: 'DELETE',
|
||||
url: path,
|
||||
}).done(function(data) {
|
||||
var msg = 'Deleted page: ' + pageName;
|
||||
bootbox.alert(msg, function() {
|
||||
location.href = '/';
|
||||
});
|
||||
}).fail(function(data, status, error) {
|
||||
bootbox.alert('Error deleting page!');
|
||||
});
|
||||
};
|
||||
|
||||
var aced = new Aced({
|
||||
editor: $('#entry-markdown-content').find('.editor').attr('id'),
|
||||
renderer: function(md) { return MDR.convert(md) },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue