summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/index
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-09-25 18:05:37 -0400
committerJules Laplace <jules@okfoc.us>2015-09-25 18:05:37 -0400
commited083ad3191a5d7d61abb21fa7dafec5121ecaab (patch)
tree46f73a62a8c8115d900221ae1b9fca7d4e662030 /public/assets/js/lib/views/index
parent3aa171fbaf05d0ee5b82673443da51ed43719475 (diff)
post comment
Diffstat (limited to 'public/assets/js/lib/views/index')
-rw-r--r--public/assets/js/lib/views/index/hootbox.js23
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