Sha256: d1e38225cd663d18a2c890f13f01a30bd174c91ca94561bb8bb30d50caf67121

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

Sprangular.directive 'promoForm', ->
  restrict: 'E'
  templateUrl: 'promos/form.html'
  scope:
    order: '='
  controller: ($scope, Cart, Checkout, Angularytics) ->
    $scope.showPromoEntry = false
    $scope.promoCode = ''

    $scope.reset = ->
      $scope.promoCode = ''
      $scope.showPromoEntry = false

    $scope.save = ->
      Checkout.savePromo($scope.promoCode)
        .then ->
          Angularytics.trackEvent("Cart", "Coupon added", $scope.promoCode)
          $scope.reset()

        , (response) ->
          $scope.promoCode = ''
          $scope.error = response.error

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sprangular-0.1.0 app/assets/javascripts/sprangular/directives/promoForm.coffee