Sha256: d4a5d6f72892a4e6461581dfd0160c8bfd3bb2b7840457376a39e864a043ce71

Contents?: true

Size: 1.47 KB

Versions: 312

Compression:

Stored size: 1.47 KB

Contents

<form id="discounts">
  <label for="gift-card" style="margin: 0 0 12px">Gift Card Number:</label>
  <input id="gift-card" name="gift_card_number" type="text" placeholder="<%= @invoice.discounts.first.code if @invoice.discounts.any? %>" maxlength="8" />
  <div id="message"></div>
  
  <input id="back" type="button" value="< Back" onclick="window.location='/checkout/shipping'" />
  <input id="next" type="submit" value="<%= if @invoice.discounts.any? then 'Update' else 'Add' end %>" />
  <input id="skip" type="button" value="<%= if @invoice.discounts.any? then 'Continue >' else 'Skip >' end %>" onclick="window.location='/checkout/billing'" />
</form>

<% content_for :caboose_js do %>
  <script>
    $(document).ready(function() {
      var $form = $('#discounts');
    
      $form.on('submit', function(event) {
        event.preventDefault();
        
        $.ajax({
          url: '/checkout/discount',
          type: 'post',
          data: $form.serialize(),
          success: function(response) {
            console.log(response);
            
            if (response.success) {
              $('#next').empty().val('Update')
              $('#skip').empty().val('Continue >');
              $('#message').removeClass('error').addClass('success');
            } else {
              $('#message').removeClass('success').addClass('error');
            }
            
            $('#message').empty().text(response.message);
          }
        });
      });
    });
  </script>
<% end %>

Version data entries

312 entries across 312 versions & 1 rubygems

Version Path
caboose-cms-0.9.229 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-1.0.2 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-1.0.1 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.228 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.227 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.226 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.225 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.224 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.223 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.222 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.221 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.220 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.219 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.218 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.217 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.216 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.215 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.214 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.213 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.9.212 app/views/caboose/checkout/_order_discount.html.erb