diff options
| -rw-r--r-- | StoneIsland/www/index.html | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/products/ProductView.js | 29 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/products/filters/ColorFilter.js | 16 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/products/filters/SizeFilter.js | 16 |
4 files changed, 10 insertions, 53 deletions
diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 22e2792a..6fb061b1 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -490,8 +490,6 @@ <script src="js/lib/products/CollectionView.js"></script> <script src="js/lib/products/filters/CategoryFilter.js"></script> -<script src="js/lib/products/filters/SizeFilter.js"></script> -<script src="js/lib/products/filters/ColorFilter.js"></script> <script src="js/lib/products/ProductView.js"></script> <script src="js/lib/products/GalleryView.js"></script> <script src="js/lib/products/Selector.js"></script> 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)) diff --git a/StoneIsland/www/js/lib/products/filters/ColorFilter.js b/StoneIsland/www/js/lib/products/filters/ColorFilter.js deleted file mode 100644 index 7b9ab5aa..00000000 --- a/StoneIsland/www/js/lib/products/filters/ColorFilter.js +++ /dev/null @@ -1,16 +0,0 @@ -var ColorFilter = View.extend({ - - initialize: function(opt){ - this.parent = opt.parent - }, - - filter: function(){ - var colors = this.find_colors_for_size(this.parent.size) - app.selector.select(colors, this.pick.bind(this)) - }, - - pick: function(choice){ - this.parent.color - }, - -}) diff --git a/StoneIsland/www/js/lib/products/filters/SizeFilter.js b/StoneIsland/www/js/lib/products/filters/SizeFilter.js deleted file mode 100644 index 46f1c234..00000000 --- a/StoneIsland/www/js/lib/products/filters/SizeFilter.js +++ /dev/null @@ -1,16 +0,0 @@ -var SizeFilter = View.extend({ - - initialize: function(opt){ - this.parent = opt.parent - }, - - filter: function(){ - var sizes = this.find_sizes_for_color(this.parent.color) - app.selector.select(sizes, this.pick.bind(this)) - }, - - pick: function(choice){ - this.parent.size - }, - -}) |
