delete comment works for non-referenced comments now

pull/16/head
posativ 12 years ago
parent d9a9eaf8c5
commit 3459b7b9ee

@ -61,7 +61,7 @@ def get(app, environ, request, path, id=None):
def modify(app, environ, request, path, id):
try:
rv = app.unsign(request.cookies.get('session-%s-%s' % (urllib.unquote(path), id), ''))
rv = app.unsign(request.cookies.get('session-%s-%s' % (urllib.quote(path, ''), id), ''))
except (SignatureExpired, BadSignature):
return abort(403)

@ -162,9 +162,24 @@
'</article>');
if (read('session-' + encodeURIComponent(window.location.pathname) + '-' + post['id'])) {
var node = $('#isso_' + post['id'] + '> footer > a:first-child')
.after('<a href="#">Bearbeiten</a>');
$('#isso_' + post['id'] + '> footer > a:first-child')
.after('<a class="delete" href="#">Löschen</a>')
.after('<a class="edit" href="#">Bearbeiten</a>');
$('#isso_' + post['id'] + ' > footer .delete').on('click', function(event) {
$.ajax({
url: '/comment/' + encodeURIComponent(window.location.pathname) + '/' + post['id'],
method: 'DELETE',
error: function(resp) {
alert('Mööp!');
},
success: function(res) {
// XXX comment might not actually deleted
$('#isso_' + post['id']).remove();
},
});
event.stop();
});
}
// ability to answer directly to a comment

Loading…
Cancel
Save