summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/details
diff options
context:
space:
mode:
authorjulian laplace <julescarbon@gmail.com>2022-10-28 14:14:33 +0200
committerjulian laplace <julescarbon@gmail.com>2022-10-28 14:14:33 +0200
commita71cc9a88b5eff9724bddcd416931159e1a016db (patch)
tree357268ecb73bbca275f1aa652d412335eb4bcb39 /public/assets/js/lib/views/details
parentb39de8cc12c83029168f311a7d3e4ddd96d52635 (diff)
comment form working
Diffstat (limited to 'public/assets/js/lib/views/details')
-rw-r--r--public/assets/js/lib/views/details/commentform.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/public/assets/js/lib/views/details/commentform.js b/public/assets/js/lib/views/details/commentform.js
index 708657d..66add7d 100644
--- a/public/assets/js/lib/views/details/commentform.js
+++ b/public/assets/js/lib/views/details/commentform.js
@@ -33,11 +33,14 @@ var CommentForm = FormView.extend({
},
keydown: function (e) {
- if ((e.ctrlKey || e.metaKey || e.altKey) && e.keyCode == 83) {
- // "s" key
- e.preventDefault();
- e.stopPropagation();
- this.save();
+ console.log(e.keyCode);
+ if (e.ctrlKey || e.metaKey || e.altKey) {
+ if (e.keyCode === 83 || e.keyCode === 13) {
+ // "s" or "enter" key
+ e.preventDefault();
+ e.stopPropagation();
+ this.save();
+ }
}
},
@@ -66,7 +69,13 @@ var CommentForm = FormView.extend({
// console.log(this.parent);
console.log(data);
if (this.opt.onSubmit) {
- this.opt.onSubmit(data);
+ this.opt.onSubmit(data, this);
}
},
+
+ destroy: function () {
+ this.hide();
+ this.undelegateEvents();
+ this.$el.remove();
+ },
});