summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/details/commentform.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/js/lib/views/details/commentform.js')
-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();
+ },
});