summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/mail/boxlist.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/js/lib/views/mail/boxlist.js')
-rw-r--r--public/assets/js/lib/views/mail/boxlist.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/public/assets/js/lib/views/mail/boxlist.js b/public/assets/js/lib/views/mail/boxlist.js
new file mode 100644
index 0000000..68494ac
--- /dev/null
+++ b/public/assets/js/lib/views/mail/boxlist.js
@@ -0,0 +1,26 @@
+var BoxList = View.extend({
+ el: "#boxes",
+
+ initialize: function(){
+ this.__super__.initialize.call(this)
+ this.template = this.$(".template").html()
+ this.$table = this.$("table")
+ },
+
+ load: function(data){
+ data.forEach(this.appendBox.bind(this))
+ },
+
+ appendBox: function(box){
+ var $row = $( this.parseBox(box) )
+ this.$table.append($row)
+ },
+
+ parseBox: function(box){
+ var t = this.template
+ .replace(/{{box}}/g, box.mbox.split(".")[1])
+ .replace(/{{count}}/g, box.count)
+ return t
+ },
+
+}) \ No newline at end of file