From 4a04a1129fffd1e128e53ba7886777c8d7b36b55 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 5 Nov 2015 01:02:20 -0500 Subject: populate product view --- StoneIsland/www/js/lib/products/ProductView.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'StoneIsland/www/js/lib/products/ProductView.js') diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index c0a1ee79..0e4063df 100644 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -8,7 +8,7 @@ var SIZE_LOOKUP = { "XXXL": "XXX-LARGE", }; -var ProductView = View.extend({ +var ProductView = ScrollableView.extend({ el: "#product", @@ -44,7 +44,16 @@ var ProductView = View.extend({ cache: {}, load: function(code, data){ - window.location.href = "#/product/" + code + this.show() + if (! app.collection.loaded) { + app.collection.afterFetchCallback = this.load.bind(this, code, data) + app.collection.fetch() + return + } + else { + app.collection.afterFetchCallback = null + } + window.location.href = "#/store/" + code data = data || app.collection.items[code] if (code in this.cache) { return this.populate(data, this.cache[code]) @@ -59,6 +68,8 @@ var ProductView = View.extend({ }, populate: function(data, details){ + this.show() +console.log(data, details) var name_partz = data['ModelNames'].split(' ') var num = name_partz.shift() var title = name_partz.join(' ') -- cgit v1.2.3-70-g09d2