delete comment works for non-referenced comments now
This commit is contained in:
parent
d9a9eaf8c5
commit
3459b7b9ee
@ -61,7 +61,7 @@ def get(app, environ, request, path, id=None):
|
|||||||
def modify(app, environ, request, path, id):
|
def modify(app, environ, request, path, id):
|
||||||
|
|
||||||
try:
|
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):
|
except (SignatureExpired, BadSignature):
|
||||||
return abort(403)
|
return abort(403)
|
||||||
|
|
||||||
|
@ -162,9 +162,24 @@
|
|||||||
'</article>');
|
'</article>');
|
||||||
|
|
||||||
if (read('session-' + encodeURIComponent(window.location.pathname) + '-' + post['id'])) {
|
if (read('session-' + encodeURIComponent(window.location.pathname) + '-' + post['id'])) {
|
||||||
var node = $('#isso_' + post['id'] + '> footer > a:first-child')
|
$('#isso_' + post['id'] + '> footer > a:first-child')
|
||||||
.after('<a href="#">Bearbeiten</a>');
|
.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
|
// ability to answer directly to a comment
|
||||||
|
Loading…
Reference in New Issue
Block a user