diff options
Diffstat (limited to 'public/assets/js/lib/views/index/hootbox.js')
| -rw-r--r-- | public/assets/js/lib/views/index/hootbox.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/public/assets/js/lib/views/index/hootbox.js b/public/assets/js/lib/views/index/hootbox.js index 9d1cc3d..4a23d32 100644 --- a/public/assets/js/lib/views/index/hootbox.js +++ b/public/assets/js/lib/views/index/hootbox.js @@ -5,10 +5,13 @@ var HootBox = FormView.extend({ events: { }, + action: "/api/thread/1/comment", + initialize: function(){ this.__super__.initialize.call(this) this.template = this.$(".template").html() this.$hoots = this.$("#hoots") + this.$comment = this.$("[name=comment]") }, load: function(comments){ @@ -31,7 +34,23 @@ var HootBox = FormView.extend({ this.$hoots.append($el) }, - success: function(){ - this.prependComment(comment) + validate: function(){ + var errors = [] + if (! this.$comment.val()) { + errors.push("no comment") + return errors + } + return null + }, + + beforeSend: function(){ + this.$comment.val("") + }, + + showErrors: function(){ + }, + + success: function(data){ + this.prependComment(data.comment) } })
\ No newline at end of file |
