Sha256: fde100108a850ebfc546dc487a36ce99380babc6826c0e797c658c84f4e734df

Contents?: true

Size: 1.46 KB

Versions: 385

Compression:

Stored size: 1.46 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="<%= @order.discounts.first.code if @order.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 @order.discounts.any? then 'Update' else 'Add' end %>" />
  <input id="skip" type="button" value="<%= if @order.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

385 entries across 385 versions & 2 rubygems

Version Path
caboose-cms-0.7.85 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.84 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.83 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.82 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.81 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.80 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.79 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.78 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.77 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.76 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.75 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.74 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.73 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.72 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.71 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.70 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.69 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.68 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.67 app/views/caboose/checkout/_order_discount.html.erb
caboose-cms-0.7.66 app/views/caboose/checkout/_order_discount.html.erb