summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/index/threadbox.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/js/lib/views/index/threadbox.js')
-rw-r--r--public/assets/js/lib/views/index/threadbox.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/public/assets/js/lib/views/index/threadbox.js b/public/assets/js/lib/views/index/threadbox.js
index bcaaceb..eee7a5c 100644
--- a/public/assets/js/lib/views/index/threadbox.js
+++ b/public/assets/js/lib/views/index/threadbox.js
@@ -1,11 +1,3 @@
-/*
-age_class
-views_class
-comments_class
-size_class
-files_class
-*/
-
var ThreadBox = View.extend({
el: ".threads",
@@ -15,10 +7,15 @@ var ThreadBox = View.extend({
initialize: function(){
this.__super__.initialize.call(this)
this.template = this.$(".template").html()
+ this.keywordTemplate = this.$(".keywordTemplate").html()
},
- load: function(threads){
- threads.forEach(this.appendThread.bind(this))
+ load: function(data){
+ if (data.keyword) {
+ var $row = this.parseKeyword(data.keyword)
+ this.$el.append($row)
+ }
+ data.threads.forEach(this.appendThread.bind(this))
},
parse: function(thread){
@@ -52,6 +49,12 @@ var ThreadBox = View.extend({
return t
},
+ parseKeyword: function(keyword){
+ var t = this.keywordTemplate
+ .replace(/{{keyword}}/g, keyword.keyword)
+ return t
+ },
+
prependThread: function(thread){
var $row = $( this.parse(thread) )
this.$el.prepend($row)