blob: 68494ac618289fcf67571fd44e8d783fa3066172 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
},
})
|