diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-11-13 20:23:08 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-11-13 20:23:08 -0500 |
| commit | a8d09a3420a94531d465057339a3e5b42a05c761 (patch) | |
| tree | 4a35dd29c3512cd877fc4feb567b4beff9d51f5d /StoneIsland/www/js/lib/products/ProductView.js | |
| parent | 93e3a8798987bcc714b6da832ecea849ad904324 (diff) | |
make size/color filters work
Diffstat (limited to 'StoneIsland/www/js/lib/products/ProductView.js')
| -rw-r--r-- | StoneIsland/www/js/lib/products/ProductView.js | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index 829fdc4b..df604d5b 100644 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -20,9 +20,6 @@ var ProductView = ScrollableView.extend({ this.$size = this.$(".size") this.$color = this.$(".color") this.$body = this.$(".body") - - this.colorFilter = new ColorFilter({ parent: this }) - this.sizeFilter = new SizeFilter({ parent: this }) }, show: function(){ @@ -138,6 +135,7 @@ var ProductView = ScrollableView.extend({ default_color = color['ColorId'] } colors[ color['ColorId'] ] = { + id: color['Code10'], code: color['Code10'], label: color['ColorDescription'], sizes: {}, @@ -147,6 +145,7 @@ var ProductView = ScrollableView.extend({ var label = SIZE_LOOKUP[ size['Default']['Text'] ] size_lookup[ label ] = size['SizeId'] sizes[ size['SizeId'] ] = { + id: label, label: label, colors: {}, } @@ -163,14 +162,10 @@ var ProductView = ScrollableView.extend({ select_size: function(){ if (this.item['Sizes'].length == 0) { return } - var mapped_sizes = this.item['Sizes'].map(function(size){ - return { - id: size['Id'], - label: SIZE_LOOKUP[ size['Text'] ], - value: size, - } - }) - app.selector.select(mapped_sizes, function(size){ + var sizes = Object.keys(this.sizes).map(function(key){ + return this.sizes[key] + }.bind(this)) + app.selector.select(sizes, function(size){ this.size = size.value this.$size.html(size.label) }.bind(this)) @@ -178,14 +173,10 @@ var ProductView = ScrollableView.extend({ select_color: function(){ if (this.item['Colors'].length == 0) { return } - var mapped_colors = this.item['Colors'].map(function(color){ - return { - id: color['Id'], - label: color['Text'], - value: color, - } - }) - app.selector.select(mapped_colors, function(color){ + var colors = Object.keys(this.colors).map(function(key){ + return this.colors[key] + }.bind(this)) + app.selector.select(colors, function(color){ this.color = color.value this.$color.html(color.label) }.bind(this)) |
