var HubView = View.extend({ el: "#hub", template: $("#hub .template").html(), events: { }, initialize: function(){ this.$content = this.$(".content") this.$loader = this.$(".loader") this.scroller = new IScroll('#hub', app.iscroll_optionsx) }, show: function(){ document.body.className = "hub" }, populate: function(data){ this.data = data this.$loader.hide() this.$content.empty() // id date subtitle body link image[uri caption] this.data.forEach(function(row){ var t = this.template.replace(/{{image}}/, row.images[0].uri) .replace(/{{date}}/, row.date) .replace(/{{code}}/, row.code) .replace(/{{title}}/, row.title) .replace(/{{subtitle}}/, row.subtitle) .replace(/{{link}}/, row.link) .replace(/{{body}}/, row.body.replace(/\n/g, "
")) this.$content.append(t) }.bind(this)) }, })