From 18eecb2faa34cbdfe558e3941c9ec0f5019a3ff9 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 17 Sep 2015 08:12:18 -0400 Subject: fetch blogviews from cms database and populate based on presumed schema --- StoneIsland/www/js/lib/blogs/HubView.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'StoneIsland/www/js/lib/blogs/HubView.js') diff --git a/StoneIsland/www/js/lib/blogs/HubView.js b/StoneIsland/www/js/lib/blogs/HubView.js index 430464b1..ce035c7d 100644 --- a/StoneIsland/www/js/lib/blogs/HubView.js +++ b/StoneIsland/www/js/lib/blogs/HubView.js @@ -8,13 +8,28 @@ var HubView = View.extend({ initialize: function(){ this.$content = this.$(".content") + this.$loader = this.$(".loader") }, show: function(){ document.body.className = "hub" }, - populate: function(){ + populate: function(data){ + this.data = data + this.$loader.hide() + this.$content.empty() + this.data.forEach(function(row){ + var t = this.template.replace({{image}}, row.image.url) + .replace({{date}}, row.date) + .replace({{code}}, row.code) + .replace({{title}}, row.title) + .replace({{subtitle}}, row.subtitle) + .replace({{link}}, row.link) + .replace({{body}}, row.body) + this.$content.append(t) + }.bind(this)) }, + }) \ No newline at end of file -- cgit v1.2.3-70-g09d2