Sha256: 9263159e47926eae5d6062aeba870b0b2d41ac1668182f0040739abc9c5ac043
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
Sprangular.controller 'ProductListCtrl', ($scope, $routeParams, Status, taxon, products, Catalog, Cart) -> if taxon Status.pageTitle = taxon.pretty_name $scope.taxon = taxon else Status.setPageTitle('nav.products') $scope.products = products $scope.taxonomies = Catalog.taxonomies() $scope.currentPage = 1 $scope.pageList = [1..products.totalPages] $scope.loadingComplete = false $scope.fetching = false $scope.selectedVariants = {} $scope.loadNextPage = -> $scope.loadPage($scope.currentPage + 1) $scope.loadPreviousPage = -> $scope.loadPage($scope.currentPage - 1) unless $scope.currentPage == 0 $scope.loadPage = (index) -> $scope.fetching = true load = if taxon Catalog.productsByTaxon(taxon.permalink, index) else Catalog.products($routeParams.search, index) load.then (newPage) -> $scope.currentPage = index $scope.pageList = [1..products.totalPages] $scope.fetching = false $scope.products = newPage $scope.loadingComplete = newPage.isLastPage $scope.selectVariant = (variant) -> $scope.selectedVariants[variant.product.id] = variant $scope.isSelected = (variant) -> $scope.selectedVariants[variant.product.id] == variant
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sprangular-0.1.0 | app/assets/javascripts/sprangular/controllers/productList.coffee |