diff options
Diffstat (limited to 'StoneIsland/www/js')
| -rw-r--r-- | StoneIsland/www/js/lib/products/GalleryView.js | 5 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/products/ProductView.js | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/StoneIsland/www/js/lib/products/GalleryView.js b/StoneIsland/www/js/lib/products/GalleryView.js index a139c454..ea4637eb 100644 --- a/StoneIsland/www/js/lib/products/GalleryView.js +++ b/StoneIsland/www/js/lib/products/GalleryView.js @@ -15,6 +15,11 @@ var GalleryView = View.extend({ this.$(".template").remove() }, + reset: function(){ + this.gallery && this.gallery.destroy() + this.$el.empty() + }, + populate: function(code, image_ids){ var valid_styles = {} image_ids.forEach(function(id){ diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index a179d227..c5a7ff29 100644 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -44,8 +44,10 @@ var ProductView = ScrollableView.extend({ cache: {}, load: function(code, data){ + this.gallery.reset() this.show() if (! app.collection.loaded) { + this.el.className = "loading" app.collection.afterFetchCallback = this.load.bind(this, code, data) app.collection.fetch() return @@ -58,6 +60,9 @@ var ProductView = ScrollableView.extend({ if (code in this.cache) { return this.populate(data, this.cache[code]) } + else { + this.el.className = "loading" + } sdk.product.item({ code: code, success: function(details){ @@ -68,7 +73,7 @@ var ProductView = ScrollableView.extend({ }, populate: function(data, details){ - this.show() + this.el.className = "" console.log(data, details) var descriptions = {} @@ -86,7 +91,7 @@ var ProductView = ScrollableView.extend({ var size_label = SIZE_LOOKUP[size] var color = data['Colors'].length && data['Colors'][0] var color_label = color && color['Text'] - var body = descriptions['EditorialDescription'] + var body = descriptions['EditorialDescription'].replace(/<br>/g, "<br><br>") this.item = data this.color = color |
