diff options
Diffstat (limited to 'public/assets/js/lib/views')
| -rw-r--r-- | public/assets/js/lib/views/details/index.js | 2 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/hootbox.js | 14 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/threadbox.js | 1 |
3 files changed, 15 insertions, 2 deletions
diff --git a/public/assets/js/lib/views/details/index.js b/public/assets/js/lib/views/details/index.js index 6290738..7757bae 100644 --- a/public/assets/js/lib/views/details/index.js +++ b/public/assets/js/lib/views/details/index.js @@ -30,7 +30,7 @@ var DetailsView = View.extend({ .replace(/{{ date }}/g, datetime[0]) .replace(/{{ time }}/g, datetime[1]) .replace(/{{ active }}/g, age + " ago") - .replace(/{{ views }}/g, thread.viewed + " " + courtesy_s(thread.viewed, "view")) + .replace(/{{ views }}/g, thread.viewed + " view" + courtesy_s(thread.viewed)) console.log(t) console.log(data.thread) // name date time active views diff --git a/public/assets/js/lib/views/index/hootbox.js b/public/assets/js/lib/views/index/hootbox.js index 9d1cc3d..f93a689 100644 --- a/public/assets/js/lib/views/index/hootbox.js +++ b/public/assets/js/lib/views/index/hootbox.js @@ -5,6 +5,17 @@ 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() @@ -31,7 +42,8 @@ var HootBox = FormView.extend({ this.$hoots.append($el) }, - success: function(){ + success: function(comment){ this.prependComment(comment) + this.$("[name=comment]").val("") } })
\ No newline at end of file diff --git a/public/assets/js/lib/views/index/threadbox.js b/public/assets/js/lib/views/index/threadbox.js index 0c6a4be..8d8cb02 100644 --- a/public/assets/js/lib/views/index/threadbox.js +++ b/public/assets/js/lib/views/index/threadbox.js @@ -35,6 +35,7 @@ var ThreadBox = View.extend({ }, parse: function(thread){ + if (thread.comment_count === undefined) return "" var views = hush_views(thread.viewed) var size = hush_size(thread.size) var comments = hush_null(thread.comment_count, "c") |
