diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-14 16:38:21 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-14 16:38:21 +0200 |
| commit | 0c8658b2a68a8e12f5e87bc82952e40ae3324a00 (patch) | |
| tree | a59bf8878f7670ecb8fc89a83ea33b9123c83d0e /public/assets/js/lib/views/details/comments.js | |
| parent | 5edc86e0f21eeccdaebc4d79964a391936049e86 (diff) | |
inline comment and delete
Diffstat (limited to 'public/assets/js/lib/views/details/comments.js')
| -rw-r--r-- | public/assets/js/lib/views/details/comments.js | 11 |
1 files changed, 9 insertions, 2 deletions
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() }, }) } |
