summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/index/threadbox.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-09-07 14:04:18 -0400
committerJules Laplace <jules@okfoc.us>2015-09-07 14:04:18 -0400
commitebac7f79d32c524de750adc3bcf1cc539625d552 (patch)
tree0967200ce631c16a54121d36a3e472eb08ad049c /public/assets/js/lib/views/index/threadbox.js
parentaa9718404cba9cf1c872b7cedded31d68d3beb54 (diff)
split up partials and stub in mailbox frontend
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)