Sha256: 99666f47bb704fdd9df2ce29ab1952bd58e662f111374ce2a6ce1def320de5db

Contents?: true

Size: 1.07 KB

Versions: 28

Compression:

Stored size: 1.07 KB

Contents

Caboose.Store.Modules.CheckoutStep2 = (function() {
    
  self = {};
  
  self.initialize = function() {                
    self.bind_event_handlers();
  };
  
  self.bind_event_handlers = function() {
    $('input[type=checkbox][name=use_as_billing]').on('change', self.use_as_billing_handler);
    $('#address_form').submit(self.continue_handler);
  };

  self.use_as_billing_handler = function(event) {    
    if (event.target.checked)
      $('#billing').hide();
    else
      $('#billing').show();    
  };
  
  self.continue_handler = function(event) {    
    $('#message').html("<p class='loading'>Saving information...</p>");
    $.ajax({
      url: '/checkout/address',
      type: 'put',      
      data: $('#address_form').serialize(),
      success: function(resp) {
        if (resp.errors && resp.errors.length > 0)
          $('#message').html("<p class='note error'>" + resp.errors[0] + "</p>");
        else if (resp.success)
          window.location = '/checkout/step-three';        
      }
    });
    return false;
  };
    
  return self
}).call(Caboose.Store);

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
caboose-store-0.0.39 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.38 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.37 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.36 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.35 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.34 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.33 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.32 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.31 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.30 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.29 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.28 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.27 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.26 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.25 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.24 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.23 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.22 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.21 app/assets/javascripts/caboose_store/modules/checkout_step2.js
caboose-store-0.0.20 app/assets/javascripts/caboose_store/modules/checkout_step2.js