From ca440c53f8a3332d6332e87c29693bb27d59b6e4 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Mon, 9 Mar 2015 11:55:33 +0900 Subject: [PATCH] Enter button now triggers comment submission --- views/stories/comments.jade | 8 +++++--- views/stories/show.jade | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/views/stories/comments.jade b/views/stories/comments.jade index a0d8cc32f1..dde7337b95 100644 --- a/views/stories/comments.jade +++ b/views/stories/comments.jade @@ -77,8 +77,10 @@ .appendTo($(this).closest('.media-body-wrapper')); var text_max = 140; $('#textarea-comment-feedback').html(text_max + ' characters remaining'); - $('#comment-to-comment-textinput').keyup(function () { - console.log('I should be showing characters remaining'); + $('#comment-to-comment-textinput').keyup(function (e) { + if (e.which === 13 || e === 13) { + $('#submit-comment-to-comment').click(); + } var text_length = $('#comment-to-comment-textinput').val().length; var text_remaining = text_max - text_length; $('#textarea-comment-feedback').html(text_remaining + ' characters remaining'); @@ -89,7 +91,7 @@ { data: { associatedPost: commentId, - body: $('#comment-to-comment-textarea').val(), + body: $('#comment-to-comment-textinput').val(), author: { picture: user.profile.picture, userId: user._id, diff --git a/views/stories/show.jade b/views/stories/show.jade index 2a9acb8421..985b9d4f2a 100644 --- a/views/stories/show.jade +++ b/views/stories/show.jade @@ -51,7 +51,10 @@ }); var text_max = 140; $('#textarea_feedback').html(text_max + ' characters remaining'); - $('#comment-box').keyup(function () { + $('#comment-box').keyup(function (e) { + if (e.which === 13 || e === 13) { + $('#comment-button').click(); + } var text_length = $('#comment-box').val().length; var text_remaining = text_max - text_length; $('#textarea_feedback').html(text_remaining + ' characters remaining');