summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/index/hootbox.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-08 02:18:49 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-08 02:18:49 +0100
commitbbbd8bbab8737f5067c85376daf79cd8a5a9c4cb (patch)
tree844d1385d7b88623eee3c2ea2c420280006ad349 /public/assets/js/lib/views/index/hootbox.js
parente4e0cf21a31b74d5ee1e6d45b343ea60ed44f372 (diff)
parentdf674eef8e20c43426c0af5aa3d1a09b5e24c58a (diff)
merge
Diffstat (limited to 'public/assets/js/lib/views/index/hootbox.js')
-rw-r--r--public/assets/js/lib/views/index/hootbox.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/public/assets/js/lib/views/index/hootbox.js b/public/assets/js/lib/views/index/hootbox.js
index f93a689..cdd3eb0 100644
--- a/public/assets/js/lib/views/index/hootbox.js
+++ b/public/assets/js/lib/views/index/hootbox.js
@@ -5,21 +5,13 @@ var HootBox = FormView.extend({
events: {
},
- validate: function(){
- var errors = []
- var comment = $("[name=comment]").val()
- if (! comment || ! comment.length) {
- errors.push("Please enter a comment.")
- }
- return errors.length ? errors : null
- },
-
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){
@@ -41,7 +33,16 @@ var HootBox = FormView.extend({
var $el = $( this.parse(comment) )
this.$hoots.append($el)
},
-
+
+ validate: function(){
+ var errors = []
+ var comment = $("[name=comment]").val()
+ if (! comment || ! comment.length) {
+ errors.push("Please enter a comment.")
+ }
+ return errors.length ? errors : null
+ },
+
success: function(comment){
this.prependComment(comment)
this.$("[name=comment]").val("")