From 3c1acfab622d470aeb1f44a708d6023530e17ec8 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 10 Dec 2017 21:08:42 +0100 Subject: more desiiiiiiiign --- public/assets/js/lib/views/details/commentform.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'public/assets/js/lib/views/details/commentform.js') diff --git a/public/assets/js/lib/views/details/commentform.js b/public/assets/js/lib/views/details/commentform.js index 3b82ac7..e082248 100644 --- a/public/assets/js/lib/views/details/commentform.js +++ b/public/assets/js/lib/views/details/commentform.js @@ -3,6 +3,7 @@ var CommentForm = FormView.extend({ el: "#comment_form", events: { + "focus textarea": 'focus', }, action: "", @@ -17,11 +18,16 @@ var CommentForm = FormView.extend({ this.action = "/api/thread/" + thread.id + "/comment" }, + focus: function(){ + this.$el.addClass('focused') + }, + validate: function(){ var errors = [] var comment = $("[name=comment]").val() - if (! comment || ! comment.length) { - errors.push("Please enter a comment.") + var files = this.$("[name=files]").val() + if ((! comment || ! comment.length) && ! files) { + errors.push("Please enter a comment or add some files.") } return errors.length ? errors : null }, -- cgit v1.2.3-70-g09d2