summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/details/commentform.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-10 21:08:42 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-10 21:08:42 +0100
commit3c1acfab622d470aeb1f44a708d6023530e17ec8 (patch)
treece596f9190c3fe8bcfba063670a6ec5a5da9d546 /public/assets/js/lib/views/details/commentform.js
parent3cc9ff370a5e3f5bf321dc56963ae3bc73e75284 (diff)
more desiiiiiiiign
Diffstat (limited to 'public/assets/js/lib/views/details/commentform.js')
-rw-r--r--public/assets/js/lib/views/details/commentform.js10
1 files changed, 8 insertions, 2 deletions
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
},