diff options
Diffstat (limited to 'StoneIsland/www/js/lib/products/CollectionView.js')
| -rw-r--r-- | StoneIsland/www/js/lib/products/CollectionView.js | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js index 652aa92b..571bb4fc 100644 --- a/StoneIsland/www/js/lib/products/CollectionView.js +++ b/StoneIsland/www/js/lib/products/CollectionView.js @@ -20,6 +20,7 @@ var CollectionView = ScrollableView.extend({ this.$content = this.$(".content") this.$loader = this.$(".loader") this.scroller = new IScroll('#collection', app.iscroll_options) + this.filterView = new CategoryFilter ({ parent: this }) }, show: function(){ @@ -32,36 +33,9 @@ var CollectionView = ScrollableView.extend({ }, ok: function(){ - var cats = this.data.SearchResponseFull.Refinements.Filters.Categories.map(function(cat){ - return { - id: cat.Id, - label: cat.Value - } - }) - if (this.filter_choice) { - cats.push({ - id: "__remove_filter", - label: "REMOVE FILTER", - }) - } - app.selector.select(cats, this.filter.bind(this)) + this.filterView.filter() }, - filter_choice: null, - filter: function(choice){ - this.$content.empty() - if (choice.id == "__remove_filter") { - this.filter_choice = null - this.data.SearchResponseFull.Results.Items.forEach(this.append.bind(this)) - } - else { - this.filter_choice = choice - this.data.SearchResponseFull.Results.Items.filter(function(item){ - return item.MacroCategory == choice.label - }).forEach(this.append.bind(this)) - } - this.deferScrollToTop() - }, - + fetch: function(){ if (this.loaded) return this.$loader.show() |
