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/commentform.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'public/assets/js/lib/views/details/commentform.js') diff --git a/public/assets/js/lib/views/details/commentform.js b/public/assets/js/lib/views/details/commentform.js index 7f04ec3..d4a9149 100644 --- a/public/assets/js/lib/views/details/commentform.js +++ b/public/assets/js/lib/views/details/commentform.js @@ -10,8 +10,8 @@ var CommentForm = FormView.extend({ action: "", - initialize: function(){ - this.__super__.initialize.call(this) + initialize: function(opt){ + this.__super__.initialize.call(this, opt) this.template = this.$(".template").html() this.$comment = this.$("[name=comment]") }, @@ -48,9 +48,12 @@ var CommentForm = FormView.extend({ return errors.length ? errors : null }, - success: function(){ + success: function(data){ $("[name=comment").val('') $("[name=files").val('') - window.location.reload() + // window.location.reload() + console.log(this) + console.log(this.parent) + this.parent.comments.load([data.comment]) } }) -- cgit v1.2.3-70-g09d2