From 0c8658b2a68a8e12f5e87bc82952e40ae3324a00 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 14 May 2018 16:38:21 +0200 Subject: inline comment and delete --- public/assets/js/lib/views/details/comments.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'public/assets/js/lib/views/details/comments.js') diff --git a/public/assets/js/lib/views/details/comments.js b/public/assets/js/lib/views/details/comments.js index 688750c..b1c86bb 100644 --- a/public/assets/js/lib/views/details/comments.js +++ b/public/assets/js/lib/views/details/comments.js @@ -15,6 +15,8 @@ var CommentsView = FormView.extend({ }, load: function(comments, thread){ +console.log(comments) + thread = this.thread = thread || this.thread if (thread.settings.hootbox) { comments .sort((a,b) => cmp(a.date, b.date)) @@ -61,6 +63,10 @@ var CommentsView = FormView.extend({ var $el = this.parse(comment) $el.insertBefore(this.$formRow) }, + + removeComment: function(id) { + this.$("[title='" + id + "']").closest('tr').remove() + }, success: function(){ this.prependComment(comment) @@ -83,8 +89,9 @@ var CommentsView = FormView.extend({ url: "/api/comment/" + id, headers: { "csrf-token": $("[name=_csrf]").attr("value") }, data: { csrf: csrf() }, - success: function(){ - window.location.reload() + success: () => { + this.removeComment(id) + // window.location.reload() }, }) } -- cgit v1.2.3-70-g09d2