0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Merge pull request #62 from ricardobeat/delete_post

Crude post delete functionality, closes #42
This commit is contained in:
Hannah Wolfe 2013-05-24 14:10:22 -07:00
commit c7f07fd8ce
4 changed files with 22 additions and 7 deletions

View file

@ -22,6 +22,21 @@
}
});
$('.post-controls .delete').on('click', function (e) {
e.preventDefault();
var postID = $('.content-list-content').find('li.active').data('id');
$.ajax({
method: 'DELETE',
url: '/api/v0.1/posts/' + postID,
success: function (res) {
window.location.reload();
},
error: function () {
window.alert('Delete failed.');
}
});
});
});
}(jQuery));

View file

@ -47,9 +47,9 @@
<a class="post-edit" href="#"><span class="hidden">Edit Post</span></a>
<a class="post-settings" href="#" data-toggle=".menu-drop-right"><span class="hidden">Post Settings</span></a>
<ul class="menu-drop-right">
<li><a href="#">URL</a></li>
<li><a href="#">Something</a></li>
<li><a href="#">Delete</a></li>
<li><a href="#" class="url">URL</a></li>
<li><a href="#" class="something">Something</a></li>
<li><a href="#" class="delete">Delete</a></li>
</ul>
</section>
</header>

View file

@ -43,8 +43,8 @@
},
// takes an identifier (id or slug?)
// returns a json response with the id of the deleted post
destroy: function (id) {
return when.call(ghost.dataProvider().posts.destroy, id);
destroy: function (args) {
return when.call(ghost.dataProvider().posts.destroy, args.id);
}
};

View file

@ -81,8 +81,8 @@
DataProvider.prototype.posts.destroy = function (_identifier, callback) {
models.Post.forge({id: _identifier}).destroy().then(function () {
callback(null);
});
callback(null, 'ok');
}, callback);
};
/**