Skip to content

Instantly share code, notes, and snippets.

@BrianTheCoder
Created October 21, 2014 07:31
Show Gist options
  • Save BrianTheCoder/e31a8cace1cc68f77e29 to your computer and use it in GitHub Desktop.
Save BrianTheCoder/e31a8cace1cc68f77e29 to your computer and use it in GitHub Desktop.
@SocialGallery = ->
restrict: 'E'
templateUrl: '/templates/products/social_gallery'
controller: ($scope, Product)->
$scope.columnCount = 2
$scope.columns = [[],[]]
$scope.product.$promise.then (product)->
Product.social_gallery slug: product.slug, (images)->
_.each images, (img, index)->
$scope.columns[index % $scope.columnCount].push(img)
.container.social-gallery
.row
h2.section-header As seen on...
.col-sm-6(ng-repeat="column in columns")
.image(ng-repeat="image in column")
img(alt="{{image.caption}}")
h4
| {{image.caption}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment