{I" class:ETI"ProcessedAsset;FI"logical_path;TI".sprangular/directives/variantSelection.js;FI" pathname;TI"o/home/josh/Projects/Dynamo/sprangular/app/assets/javascripts/sprangular/directives/variantSelection.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+¯ UI" length;TiEI" digest;TI"%85d6d4f35d407326e30ed260fd1443db;FI" source;TI"E(function() { 'use strict'; Sprangular.directive('variantSelection', function() { return { restrict: 'E', templateUrl: 'directives/variant_selection.html', scope: { product: '=', variant: '=', "class": '=', change: '&' }, controller: function($scope) { $scope.values = {}; $scope.$watch('variant', function(newVariant, oldVariant) { if (newVariant !== oldVariant) { return $scope.change({ oldVariant: oldVariant, newVariant: newVariant }); } }); $scope.isValueSelected = function(value) { var ref; return ((ref = $scope.values[value.option_type_id]) != null ? ref.id : void 0) === value.id; }; $scope.isValueAvailable = function(value) { return $scope.product.availableValues(_.values($scope.values)); }; return $scope.selectValue = function(value) { $scope.values[value.option_type_id] = value; return $scope.variant = $scope.product.variantForValues(_.values($scope.values)); }; }, link: function(scope, element, attrs) { var i, len, ref, results, value; scope.values = {}; if (scope.variant) { ref = scope.variant.option_values; results = []; for (i = 0, len = ref.length; i < len; i++) { value = ref[i]; results.push(scope.values[value.option_type_id] = value); } return results; } } }; }); }).call(this); ;TI"dependency_digest;TI"%7b50d8430afc9abdfe89a45fd4505e7f;FI"required_paths;T[I"o/home/josh/Projects/Dynamo/sprangular/app/assets/javascripts/sprangular/directives/variantSelection.coffee;FI"dependency_paths;T[{I" path;TI"o/home/josh/Projects/Dynamo/sprangular/app/assets/javascripts/sprangular/directives/variantSelection.coffee;FI" mtime;TI"2015-03-18T13:00:02-04:00;TI" digest;TI"%55760f82e937f5203fbdbd785c682690;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F