Sha256: a72dde755b0b2246f29ff8f3001735cc9d10f67240671a1b200c8a635b15a3d4

Contents?: true

Size: 608 Bytes

Versions: 5

Compression:

Stored size: 608 Bytes

Contents

$(@).ready( ->
  $('[data-hook=adjustments_new_coupon_code] #add_coupon_code').click ->
    return if $("#coupon_code").val().length == 0
    $.ajax
      type: 'PUT'
      url: Spree.url(Spree.routes.orders_api + '/' + order_number + '/apply_coupon_code.json');
      data:
        coupon_code: $("#coupon_code").val()
        token: Spree.api_key
      success: ->
        window.location.reload();
      error: (msg) ->
        if msg.responseJSON["error"]
          show_flash 'error', msg.responseJSON["error"]
        else
          show_flash 'error', "There was a problem adding this coupon code."
)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spree_backend-2.2.14 app/assets/javascripts/spree/backend/adjustments.js.coffee
spree_backend-2.2.13 app/assets/javascripts/spree/backend/adjustments.js.coffee
spree_backend-2.2.12 app/assets/javascripts/spree/backend/adjustments.js.coffee
spree_backend-2.2.11 app/assets/javascripts/spree/backend/adjustments.js.coffee
spree_backend-2.2.10 app/assets/javascripts/spree/backend/adjustments.js.coffee