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.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
},