From 63a986d31c34e945e31286b747869da1fce23b14 Mon Sep 17 00:00:00 2001 From: Fernando Blat Date: Fri, 20 Jan 2017 18:35:34 +0100 Subject: [PATCH] If the comment has errors, show the textarea with the error message --- app/views/legislation/annotations/comments.js.erb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/views/legislation/annotations/comments.js.erb b/app/views/legislation/annotations/comments.js.erb index 7718b0465..8074f6040 100644 --- a/app/views/legislation/annotations/comments.js.erb +++ b/app/views/legislation/annotations/comments.js.erb @@ -10,3 +10,8 @@ $('a.publish-comment').on({ } }); +<% if @comment.errors.any? %> + $('a.publish-comment').hide(); + $('#js-comment-form-annotation').toggle(); + $('#js-comment-form-annotation textarea').focus(); +<% end %>