Sha256: 241434c3e3c869824e150ed44b32c139130a2ab2b661970dff493b98294192e3
Contents?: true
Size: 1.24 KB
Versions: 13
Compression:
Stored size: 1.24 KB
Contents
hideShippingAddressFields = (shipping_address) -> shipping_address.hide().find('input,select').removeProp('required') showShippingAddressFields = (shipping_address) -> shipping_address.show().find("input:not([name$='[address2]']),select:not([name$='[state_code]'])").prop('required', true) initShippingAddressFields = -> effective_order = $('.effective-order').first() if effective_order.length > 0 shipping_address_same_as_billing = effective_order.find('#effective_order_shipping_address_same_as_billing') shipping_address = effective_order.find('.shipping_address_fields') if shipping_address_same_as_billing.length > 0 && shipping_address.length > 0 if shipping_address_same_as_billing.is(':checked') hideShippingAddressFields(shipping_address) else showShippingAddressFields(shipping_address) $ -> initShippingAddressFields() $(document).on 'page:change', -> initShippingAddressFields() $(document).on 'change', '#effective_order_shipping_address_same_as_billing', (event) -> obj = $(event.currentTarget) shipping_address = obj.closest('form').find('.shipping_address_fields') if obj.is(':checked') hideShippingAddressFields(shipping_address) else showShippingAddressFields(shipping_address)
Version data entries
13 entries across 13 versions & 1 rubygems