diff options
Diffstat (limited to 'public/assets/js/lib/views/index/hootbox.js')
| -rw-r--r-- | public/assets/js/lib/views/index/hootbox.js | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/public/assets/js/lib/views/index/hootbox.js b/public/assets/js/lib/views/index/hootbox.js index 4a23d32..cdd3eb0 100644 --- a/public/assets/js/lib/views/index/hootbox.js +++ b/public/assets/js/lib/views/index/hootbox.js @@ -33,24 +33,18 @@ var HootBox = FormView.extend({ var $el = $( this.parse(comment) ) this.$hoots.append($el) }, - + validate: function(){ var errors = [] - if (! this.$comment.val()) { - errors.push("no comment") - return errors + var comment = $("[name=comment]").val() + if (! comment || ! comment.length) { + errors.push("Please enter a comment.") } - return null - }, - - beforeSend: function(){ - this.$comment.val("") + return errors.length ? errors : null }, - - showErrors: function(){ - }, - - success: function(data){ - this.prependComment(data.comment) + + success: function(comment){ + this.prependComment(comment) + this.$("[name=comment]").val("") } })
\ No newline at end of file |
