From 5d68db92b37545fb03332a46b01d0f1aad8ce64b Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 17 Sep 2015 21:26:52 -0400 Subject: populate selector --- .../platforms/ios/www/js/lib/blogs/BlogView.js | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js (limited to 'StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js') diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js new file mode 100644 index 00000000..70fc910a --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js @@ -0,0 +1,33 @@ +var BlogView = View.extend({ + + data: null, + loaded: false, + initialize: function(){ + this.loader = new Loader () + this.fetch() + }, + + fetch: function(){ + $.ajax({ + method: "GET", + url: "http://stone.sup.land/db.json", + success: this.success.bind(this), + cache: true, + }) + }, + + success: function(data){ + this.loaded = true + this.data = data + this.loader.preloadImage(data.archive[0].image.url, function(img){ + app.archive.populate(data.archive) + }) + this.loader.preloadImage(data.hub[0].image.url, function(img){ + app.hub.populate(data.hub) + }) + this.loader.preloadImage(data.story[0].image.url, function(img){ + app.story.populate(data.story) + }) + }, + +}) \ No newline at end of file -- cgit v1.2.3-70-g09d2