diff options
| author | julian laplace <julescarbon@gmail.com> | 2022-10-28 13:47:06 +0200 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2022-10-28 13:47:06 +0200 |
| commit | b39de8cc12c83029168f311a7d3e4ddd96d52635 (patch) | |
| tree | 0aa3f141e050187821e82f787f37a30e9157ea62 /public/assets/js/lib/views/details/commentform.js | |
| parent | 02bb7181aca0298dbc8b29ba0aeac3e07f643930 (diff) | |
toggle form
Diffstat (limited to 'public/assets/js/lib/views/details/commentform.js')
| -rw-r--r-- | public/assets/js/lib/views/details/commentform.js | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/public/assets/js/lib/views/details/commentform.js b/public/assets/js/lib/views/details/commentform.js index 6dddd26..708657d 100644 --- a/public/assets/js/lib/views/details/commentform.js +++ b/public/assets/js/lib/views/details/commentform.js @@ -13,6 +13,15 @@ var CommentForm = FormView.extend({ this.__super__.initialize.call(this, opt); this.template = this.$(".template").html(); this.$comment = this.$("[name=comment]"); + console.log("initialize"); + }, + + show: function () { + this.$el.show(); + }, + + hide: function () { + this.$el.hide(); }, load: function (thread) { @@ -40,8 +49,9 @@ var CommentForm = FormView.extend({ validate: function () { var errors = []; - var comment = $("[name=comment]").val(); + var comment = this.$("[name=comment]").val(); var files = this.$("[name=files]").val(); + console.log(comment, files); if ((!comment || !comment.length) && !files) { errors.push("Please enter a comment or add some files."); } @@ -52,11 +62,11 @@ var CommentForm = FormView.extend({ $("[name=comment").val(""); $("[name=files").val(""); // window.location.reload() - console.log(this); - console.log(this.parent); + // console.log(this); + // console.log(this.parent); console.log(data); - data.comment && this.parent.comments.load([data.comment]); - data.files && this.parent.files.add(data.files); - data.files && this.parent.gallery.add(data.files); + if (this.opt.onSubmit) { + this.opt.onSubmit(data); + } }, }); |
