Sha256: 1be358eb74399b58d3b5f66d8adf22663743d5839b7bfe5b7ab15f25c4172281
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
Sprangular.controller 'HomeCtrl', ( $scope, Status, Catalog, products, Cart, $translate ) -> Status.setPageTitle('app.home') $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 Catalog.products(null, index) .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/home.coffee |