caboose-cms 0.4.151 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose/admin_products.js +79 -0
- data/app/assets/javascripts/caboose/application.js +2 -1
- data/app/assets/javascripts/caboose/cart.js +168 -0
- data/app/assets/javascripts/caboose/checkout.js +151 -0
- data/app/assets/javascripts/caboose/checkout_module.js +312 -0
- data/app/assets/javascripts/caboose/checkout_step1.js +179 -0
- data/app/assets/javascripts/caboose/checkout_step2.js +39 -0
- data/app/assets/javascripts/caboose/checkout_step3.js +34 -0
- data/app/assets/javascripts/caboose/checkout_step4.js +97 -0
- data/app/assets/javascripts/caboose/main.js +99 -8
- data/app/assets/javascripts/caboose/product.js +284 -0
- data/app/assets/stylesheets/caboose/admin_products.css +86 -0
- data/app/assets/templates/caboose/cart/add_to_cart.jst.ejs +7 -0
- data/app/assets/templates/caboose/cart/line_items.jst.ejs +41 -0
- data/app/assets/templates/caboose/checkout/address.jst.ejs +53 -0
- data/app/assets/templates/caboose/checkout/forms/guest.jst.ejs +8 -0
- data/app/assets/templates/caboose/checkout/forms/register.jst.ejs +11 -0
- data/app/assets/templates/caboose/checkout/forms/signin.jst.ejs +7 -0
- data/app/assets/templates/caboose/checkout/line_items.jst.ejs +31 -0
- data/app/assets/templates/caboose/checkout/login.jst.ejs +21 -0
- data/app/assets/templates/caboose/checkout/payment.jst.ejs +5 -0
- data/app/assets/templates/caboose/checkout/shipping.jst.ejs +18 -0
- data/app/assets/templates/caboose/product/images.jst.ejs +8 -0
- data/app/assets/templates/caboose/product/options.jst.ejs +19 -0
- data/app/controllers/caboose/application_controller.rb +29 -1
- data/app/controllers/caboose/cart_controller.rb +52 -0
- data/app/controllers/caboose/categories_controller.rb +108 -0
- data/app/controllers/caboose/checkout_controller.rb +325 -0
- data/app/controllers/caboose/orders_controller.rb +439 -0
- data/app/controllers/caboose/product_images_controller.rb +38 -0
- data/app/controllers/caboose/products_controller.rb +737 -0
- data/app/controllers/caboose/reviews_controller.rb +15 -0
- data/app/controllers/caboose/variants_controller.rb +218 -0
- data/app/controllers/caboose/vendors_controller.rb +73 -0
- data/app/helpers/caboose/application_helper.rb +4 -0
- data/app/helpers/caboose/categories_helper.rb +82 -0
- data/app/helpers/caboose/checkout_helper.rb +20 -0
- data/app/helpers/caboose/products_helper.rb +8 -0
- data/app/mailers/caboose/orders_mailer.rb +30 -0
- data/app/models/caboose/address.rb +26 -0
- data/app/models/caboose/category.rb +89 -0
- data/app/models/caboose/category_membership.rb +10 -0
- data/app/models/caboose/core_plugin.rb +15 -37
- data/app/models/caboose/customization_membership.rb +10 -0
- data/app/models/caboose/discount.rb +16 -0
- data/app/models/caboose/line_item.rb +81 -0
- data/app/models/caboose/message.rb +20 -0
- data/app/models/caboose/order.rb +191 -0
- data/app/models/caboose/order_discount.rb +10 -0
- data/app/models/caboose/order_pdf.rb +78 -0
- data/app/models/caboose/payment_processors/authorizenet.rb +53 -0
- data/app/models/caboose/payment_processors/base.rb +39 -0
- data/app/models/caboose/payment_processors/payscape.rb +94 -0
- data/app/models/caboose/product.rb +145 -0
- data/app/models/caboose/product_image.rb +62 -0
- data/app/models/caboose/product_image_variant.rb +10 -0
- data/app/models/caboose/review.rb +13 -0
- data/app/models/caboose/schema.rb +205 -1
- data/app/models/caboose/search_filter.rb +191 -0
- data/app/models/caboose/shipping_calculator.rb +81 -0
- data/app/models/caboose/states.rb +61 -52
- data/app/models/caboose/tax_calculator.rb +23 -0
- data/app/models/caboose/tax_line.rb +9 -0
- data/app/models/caboose/variant.rb +99 -0
- data/app/models/caboose/vendor.rb +22 -0
- data/app/views/caboose/cart/index.html.erb +8 -0
- data/app/views/caboose/categories/admin_edit.html.erb +79 -0
- data/app/views/caboose/categories/admin_index.html.erb +11 -0
- data/app/views/caboose/categories/admin_new.html.erb +62 -0
- data/app/views/caboose/checkout/_address_form.html.erb +111 -0
- data/app/views/caboose/checkout/_billing_form.html.erb +47 -0
- data/app/views/caboose/checkout/_cart.html.erb +52 -0
- data/app/views/caboose/checkout/_confirm.html.erb +61 -0
- data/app/views/caboose/checkout/_order_discount.html.erb +40 -0
- data/app/views/caboose/checkout/_shipping_address.html.erb +10 -0
- data/app/views/caboose/checkout/_shipping_method.html.erb +2 -0
- data/app/views/caboose/checkout/_shipping_method_form.html.erb +21 -0
- data/app/views/caboose/checkout/billing.html.erb +11 -0
- data/app/views/caboose/checkout/discount.html.erb +11 -0
- data/app/views/caboose/checkout/empty.html.erb +2 -0
- data/app/views/caboose/checkout/error.html.erb +2 -0
- data/app/views/caboose/checkout/index.html.erb +43 -0
- data/app/views/caboose/checkout/login.html.erb +2 -0
- data/app/views/caboose/checkout/payment.html.erb +79 -0
- data/app/views/caboose/checkout/relay.html.erb +23 -0
- data/app/views/caboose/checkout/relay_old.html.erb +12 -0
- data/app/views/caboose/checkout/relay_postMessage.html.erb +19 -0
- data/app/views/caboose/checkout/shipping.html.erb +15 -0
- data/app/views/caboose/checkout/step_four.html.erb +93 -0
- data/app/views/caboose/checkout/step_one.html.erb +56 -0
- data/app/views/caboose/checkout/step_one_old.html.erb +13 -0
- data/app/views/caboose/checkout/step_three.html.erb +23 -0
- data/app/views/caboose/checkout/step_two.html.erb +52 -0
- data/app/views/caboose/checkout/step_two_old.html.erb +14 -0
- data/app/views/caboose/checkout/thanks.html.erb +5 -0
- data/app/views/caboose/orders/_admin_footer.html.erb +2 -0
- data/app/views/caboose/orders/_admin_header.html.erb +31 -0
- data/app/views/caboose/orders/_quickbooks_order.html.erb +0 -0
- data/app/views/caboose/orders/admin_delete_form.html.erb +21 -0
- data/app/views/caboose/orders/admin_edit.html.erb +271 -0
- data/app/views/caboose/orders/admin_index.html.erb +89 -0
- data/app/views/caboose/orders/admin_new.html.erb +42 -0
- data/app/views/caboose/orders/admin_print.html.erb +72 -0
- data/app/views/caboose/orders_mailer/customer_new_order.html.erb +1 -0
- data/app/views/caboose/orders_mailer/customer_status_updated.html.erb +1 -0
- data/app/views/caboose/orders_mailer/fulfillment_new_order.html.erb +1 -0
- data/app/views/caboose/orders_mailer/shipping_order_ready.html.erb +1 -0
- data/app/views/caboose/products/_admin_footer.html.erb +2 -0
- data/app/views/caboose/products/_admin_header.html.erb +32 -0
- data/app/views/caboose/products/_sort_options.html.erb +19 -0
- data/app/views/caboose/products/admin_add_upcs.html.erb +58 -0
- data/app/views/caboose/products/admin_delete_form.html.erb +21 -0
- data/app/views/caboose/products/admin_edit_categories.html.erb +73 -0
- data/app/views/caboose/products/admin_edit_category_images.html.erb +233 -0
- data/app/views/caboose/products/admin_edit_description.html.erb +38 -0
- data/app/views/caboose/products/admin_edit_general.html.erb +104 -0
- data/app/views/caboose/products/admin_edit_images.html.erb +236 -0
- data/app/views/caboose/products/admin_edit_options.html.erb +51 -0
- data/app/views/caboose/products/admin_edit_seo.html.erb +37 -0
- data/app/views/caboose/products/admin_edit_variant_columns.html.erb +75 -0
- data/app/views/caboose/products/admin_edit_variant_sort_order.html.erb +63 -0
- data/app/views/caboose/products/admin_edit_variants.html.erb +171 -0
- data/app/views/caboose/products/admin_edit_variants_single.html.erb +68 -0
- data/app/views/caboose/products/admin_group_variants.html.erb +433 -0
- data/app/views/caboose/products/admin_index.html.erb +95 -0
- data/app/views/caboose/products/admin_new.html.erb +41 -0
- data/app/views/caboose/products/admin_sort.html copy.erb +155 -0
- data/app/views/caboose/products/admin_sort.html.erb +254 -0
- data/app/views/caboose/products/details.html.erb +438 -0
- data/app/views/caboose/products/index.html.erb +46 -0
- data/app/views/caboose/products/not_available.html.erb +35 -0
- data/app/views/caboose/variants/admin_edit.html.erb +82 -0
- data/app/views/caboose/variants/admin_group.html.erb +184 -0
- data/app/views/caboose/variants/admin_new.html.erb +59 -0
- data/app/views/caboose/vendors/admin_edit.html.erb +24 -0
- data/app/views/caboose/vendors/admin_index.html.erb +30 -0
- data/app/views/caboose/vendors/admin_new.html.erb +34 -0
- data/app/views/layouts/caboose/store/_banner.html.erb +10 -0
- data/app/views/layouts/caboose/store/_banner2.html.erb +10 -0
- data/app/views/layouts/caboose/store/_footer.html.erb +55 -0
- data/app/views/layouts/caboose/store/_header.html.erb +69 -0
- data/app/views/layouts/caboose/store/_sidebar.html.erb +27 -0
- data/app/views/layouts/caboose/store/application.html.erb +33 -0
- data/app/views/layouts/caboose/store/authorize_net.erb +18 -0
- data/app/views/layouts/caboose/store/layout_about.html.erb +42 -0
- data/app/views/layouts/caboose/store/layout_blog.html.erb +159 -0
- data/app/views/layouts/caboose/store/layout_confirm.html.erb +85 -0
- data/app/views/layouts/caboose/store/layout_contact.html.erb +38 -0
- data/app/views/layouts/caboose/store/layout_default.html.erb +10 -0
- data/app/views/layouts/caboose/store/layout_detail.html.erb +114 -0
- data/app/views/layouts/caboose/store/layout_order.html.erb +77 -0
- data/app/views/layouts/caboose/store/layout_pricing.html.erb +182 -0
- data/app/views/layouts/caboose/store/layout_product.html.erb +110 -0
- data/app/views/layouts/caboose/store/layout_profile.html.erb +55 -0
- data/app/views/layouts/caboose/store/layout_single.html.erb +3 -0
- data/app/views/layouts/caboose/store/layout_testimonial.html.erb +110 -0
- data/app/views/layouts/caboose/store/layout_testing.html.erb +4 -0
- data/config/routes.rb +126 -0
- data/lib/caboose.rb +46 -1
- data/lib/caboose/engine.rb +39 -1
- data/lib/caboose/version.rb +1 -1
- data/lib/tasks/caboose.rake +12 -0
- metadata +151 -4
- data/app/assets/javascripts/caboose/admin_page_edit_content_bak.js +0 -164
- data/app/assets/javascripts/caboose/model/#Untitled-1# +0 -2
@@ -0,0 +1,179 @@
|
|
1
|
+
//
|
2
|
+
// Checkout
|
3
|
+
//
|
4
|
+
|
5
|
+
Caboose.Store.Modules.CheckoutStep1 = (function() {
|
6
|
+
|
7
|
+
// Steps
|
8
|
+
// Step 1: Present non-editable cart and login/register/guest buttons.
|
9
|
+
// Step 2: Present shipping address form.
|
10
|
+
// Step 3: Present shipping options.
|
11
|
+
// Step 4: Present credit card form.
|
12
|
+
// Step 5: Thank you.
|
13
|
+
|
14
|
+
self = {};
|
15
|
+
|
16
|
+
//
|
17
|
+
// Initialize
|
18
|
+
//
|
19
|
+
|
20
|
+
self.initialize = function() {
|
21
|
+
switch (window.location.pathname.replace(/\/$/, "")) {
|
22
|
+
case '/checkout':
|
23
|
+
case '/checkout/step-one': self.step = 1; break;
|
24
|
+
}
|
25
|
+
|
26
|
+
$('#signin_form_container' ).slideUp();
|
27
|
+
$('#register_form_container' ).slideUp();
|
28
|
+
$('#guest_form_container' ).slideUp();
|
29
|
+
|
30
|
+
self.$checkout = $('#checkout')
|
31
|
+
self.bindEventHandlers();
|
32
|
+
};
|
33
|
+
|
34
|
+
//
|
35
|
+
// Events
|
36
|
+
//
|
37
|
+
|
38
|
+
self.bindEventHandlers = function() {
|
39
|
+
self.$checkout.on('click' , '[data-login-action]', self.login_click_handler);
|
40
|
+
//self.$checkout.on('submit', '#checkout-login form', self.login_submit_handler);
|
41
|
+
//self.$checkout.on('click' , '#checkout-continue button', self.continue_handler);
|
42
|
+
$('#signin_form' ).submit(self.login_form_submit_handler);
|
43
|
+
$('#register_form').submit(self.register_form_submit_handler);
|
44
|
+
$('#guest_form' ).submit(self.guest_form_submit_handler);
|
45
|
+
};
|
46
|
+
|
47
|
+
self.login_click_handler = function(event) {
|
48
|
+
var form = $(event.target).data('login-action');
|
49
|
+
if (self.current_form && form == self.current_form)
|
50
|
+
return;
|
51
|
+
if (self.current_form)
|
52
|
+
{
|
53
|
+
$('#' + self.current_form + '_form_container').slideUp(400, function() {
|
54
|
+
$('#' + form + '_form_container').slideDown();
|
55
|
+
});
|
56
|
+
$('#' + self.current_form + '_button').removeClass('selected');
|
57
|
+
}
|
58
|
+
else
|
59
|
+
{
|
60
|
+
$('#' + form + '_form_container').slideDown();
|
61
|
+
}
|
62
|
+
$('#' + form + '_button').addClass('selected');
|
63
|
+
$('#message').empty();
|
64
|
+
|
65
|
+
$('html, body').animate({
|
66
|
+
scrollTop: $('#checkout-login').offset().top
|
67
|
+
}, 600);
|
68
|
+
|
69
|
+
self.current_form = form;
|
70
|
+
};
|
71
|
+
|
72
|
+
//self.login_submit_handler = function(event) {
|
73
|
+
// event.preventDefault();
|
74
|
+
// var $form = $(event.target);
|
75
|
+
//
|
76
|
+
// $.ajax({
|
77
|
+
// type: $form.attr('method'),
|
78
|
+
// url: $form.attr('action'),
|
79
|
+
// data: $form.serialize(),
|
80
|
+
// success: function(response) {
|
81
|
+
// if (response.error || (response.errors && response.errors.length > 0)) {
|
82
|
+
// if ($form.find('.message').length) {
|
83
|
+
// $form.find('.message').empty().addClass('error').text(response.error || response.errors[0]);
|
84
|
+
// } else {
|
85
|
+
// $form.append($('<span/>').addClass('message error').text(response.error || response.errors[0]));
|
86
|
+
// }
|
87
|
+
// } else {
|
88
|
+
// if (response.logged_in) {
|
89
|
+
// self.$login.after($('<p/>').addClass('alert').text('You are now signed in').css('text-align', 'center')).remove();
|
90
|
+
// $.post('/checkout/attach-user');
|
91
|
+
// } else {
|
92
|
+
// self.$login.after($('<p/>').addClass('alert').text('Email successfully saved').css('text-align', 'center')).remove();
|
93
|
+
// }
|
94
|
+
// }
|
95
|
+
//
|
96
|
+
// self.fetch(self.render);
|
97
|
+
// }
|
98
|
+
// });
|
99
|
+
//};
|
100
|
+
|
101
|
+
//self.continueHandler = function(event) {
|
102
|
+
// $form = self.$address.find('form');
|
103
|
+
//
|
104
|
+
// $.ajax({
|
105
|
+
// type: $form.attr('method'),
|
106
|
+
// url: $form.attr('action'),
|
107
|
+
// data: $form.serialize(),
|
108
|
+
// success: function(response) {
|
109
|
+
// if (response.success) {
|
110
|
+
// window.location = '/checkout/step-two';
|
111
|
+
// } else {
|
112
|
+
// $form.find('.message').remove();
|
113
|
+
// $form.find('#' + response.address + ' h3').append($('<span/>').addClass('message error').text(response.errors[0]));
|
114
|
+
// }
|
115
|
+
// }
|
116
|
+
// });
|
117
|
+
//};
|
118
|
+
|
119
|
+
self.login_form_submit_handler = function(event) {
|
120
|
+
$('#message').html("<p class='loading'>Logging in...</p>");
|
121
|
+
$.ajax({
|
122
|
+
url: '/login',
|
123
|
+
type: 'post',
|
124
|
+
data: $('#signin_form').serialize(),
|
125
|
+
success: function(resp) {
|
126
|
+
if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
|
127
|
+
else
|
128
|
+
{
|
129
|
+
$.ajax({
|
130
|
+
url: '/checkout/attach-user',
|
131
|
+
type: 'post',
|
132
|
+
success: function(resp2) {
|
133
|
+
if (resp2.error) $('#message').html("<p class='note error'>" + resp2.error + "</p>");
|
134
|
+
else window.location = '/checkout/step-two';
|
135
|
+
}
|
136
|
+
});
|
137
|
+
}
|
138
|
+
}
|
139
|
+
});
|
140
|
+
return false;
|
141
|
+
};
|
142
|
+
|
143
|
+
self.register_form_submit_handler = function(event) {
|
144
|
+
$('#message').html("<p class='loading'>Registering...</p>");
|
145
|
+
$.ajax({
|
146
|
+
url: '/register',
|
147
|
+
type: 'post',
|
148
|
+
data: $('#register_form').serialize(),
|
149
|
+
success: function(resp) {
|
150
|
+
if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
|
151
|
+
$.ajax({
|
152
|
+
url: '/checkout/attach-user',
|
153
|
+
type: 'post',
|
154
|
+
success: function(resp2) {
|
155
|
+
if (resp2.error) $('#message').html("<p class='note error'>" + resp2.error + "</p>");
|
156
|
+
else window.location = '/checkout/step-two';
|
157
|
+
}
|
158
|
+
});
|
159
|
+
}
|
160
|
+
});
|
161
|
+
return false;
|
162
|
+
};
|
163
|
+
|
164
|
+
self.guest_form_submit_handler = function(event) {
|
165
|
+
$('#message').html("<p class='loading'>Submitting...</p>");
|
166
|
+
$.ajax({
|
167
|
+
url: '/checkout/attach-guest',
|
168
|
+
type: 'post',
|
169
|
+
data: $('#guest_form').serialize(),
|
170
|
+
success: function(resp) {
|
171
|
+
if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
|
172
|
+
else window.location = '/checkout/step-two';
|
173
|
+
}
|
174
|
+
});
|
175
|
+
return false;
|
176
|
+
};
|
177
|
+
|
178
|
+
return self
|
179
|
+
}).call(Caboose.Store);
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
Caboose.Store.Modules.CheckoutStep2 = (function() {
|
3
|
+
|
4
|
+
self = {};
|
5
|
+
|
6
|
+
self.initialize = function() {
|
7
|
+
self.bind_event_handlers();
|
8
|
+
};
|
9
|
+
|
10
|
+
self.bind_event_handlers = function() {
|
11
|
+
$('input[type=checkbox][name=use_as_billing]').on('change', self.use_as_billing_handler);
|
12
|
+
$('#address_form').submit(self.continue_handler);
|
13
|
+
};
|
14
|
+
|
15
|
+
self.use_as_billing_handler = function(event) {
|
16
|
+
if (event.target.checked)
|
17
|
+
$('#billing').hide();
|
18
|
+
else
|
19
|
+
$('#billing').show();
|
20
|
+
};
|
21
|
+
|
22
|
+
self.continue_handler = function(event) {
|
23
|
+
$('#message').html("<p class='loading'>Saving information...</p>");
|
24
|
+
$.ajax({
|
25
|
+
url: '/checkout/address',
|
26
|
+
type: 'put',
|
27
|
+
data: $('#address_form').serialize(),
|
28
|
+
success: function(resp) {
|
29
|
+
if (resp.errors && resp.errors.length > 0)
|
30
|
+
$('#message').html("<p class='note error'>" + resp.errors[0] + "</p>");
|
31
|
+
else if (resp.success)
|
32
|
+
window.location = '/checkout/step-three';
|
33
|
+
}
|
34
|
+
});
|
35
|
+
return false;
|
36
|
+
};
|
37
|
+
|
38
|
+
return self
|
39
|
+
}).call(Caboose.Store);
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
Caboose.Store.Modules.CheckoutStep3 = (function() {
|
3
|
+
|
4
|
+
self = {};
|
5
|
+
|
6
|
+
self.initialize = function() {
|
7
|
+
self.bind_event_handlers();
|
8
|
+
};
|
9
|
+
|
10
|
+
self.bind_event_handlers = function() {
|
11
|
+
$('#checkout button').click(self.shipping_click_handler);
|
12
|
+
};
|
13
|
+
|
14
|
+
self.shipping_click_handler = function(event) {
|
15
|
+
$('#message').html("<p class='loading'>Saving information...</p>");
|
16
|
+
$.ajax({
|
17
|
+
url: '/checkout/shipping',
|
18
|
+
type: 'put',
|
19
|
+
data: {
|
20
|
+
shipping_method: $(event.target).data('shipping-method'),
|
21
|
+
shipping_method_code: $(event.target).data('shipping-code')
|
22
|
+
},
|
23
|
+
success: function(resp) {
|
24
|
+
if (resp.errors && resp.errors.length > 0)
|
25
|
+
$('#message').html("<p class='note error'>" + resp.errors[0] + "</p>");
|
26
|
+
else if (resp.success)
|
27
|
+
window.location = '/checkout/step-four';
|
28
|
+
}
|
29
|
+
});
|
30
|
+
return false;
|
31
|
+
};
|
32
|
+
|
33
|
+
return self
|
34
|
+
}).call(Caboose.Store);
|
@@ -0,0 +1,97 @@
|
|
1
|
+
|
2
|
+
Caboose.Store.Modules.CheckoutStep4 = (function() {
|
3
|
+
|
4
|
+
self = {
|
5
|
+
is_confirm: false
|
6
|
+
};
|
7
|
+
|
8
|
+
self.initialize = function() {
|
9
|
+
$('#checkout-confirm').hide();
|
10
|
+
$('#relay').hide();
|
11
|
+
self.bind_event_handlers();
|
12
|
+
self.expiration_change_handler();
|
13
|
+
};
|
14
|
+
|
15
|
+
self.bind_event_handlers = function() {
|
16
|
+
$('#checkout-payment form#payment select').change(self.expiration_change_handler);
|
17
|
+
$('#checkout-continue button').click(self.continue_handler);
|
18
|
+
$('#checkout-confirm #edit_payment').click(self.edit_payment_handler);
|
19
|
+
|
20
|
+
$(window).on('message', function(event) {
|
21
|
+
relay_handler(event.originalEvent.data);
|
22
|
+
});
|
23
|
+
};
|
24
|
+
|
25
|
+
self.expiration_change_handler = function(event) {
|
26
|
+
var form = $('#checkout-payment #payment')
|
27
|
+
month = form.find('select[name=month]').val()
|
28
|
+
year = form.find('select[name=year]').val();
|
29
|
+
$('#expiration').val(month + year);
|
30
|
+
};
|
31
|
+
|
32
|
+
self.continue_handler = function(event) {
|
33
|
+
if (!self.is_confirm)
|
34
|
+
{
|
35
|
+
var cc = $('#billing-cc-number').val();
|
36
|
+
if (cc.length < 15)
|
37
|
+
$('#message').html("<p class='note error'>Please enter a valid credit card number.</p>");
|
38
|
+
else
|
39
|
+
{
|
40
|
+
$('#message').empty();
|
41
|
+
$('#checkout-payment').hide();
|
42
|
+
$('#checkout-confirm').show();
|
43
|
+
$('#checkout_nav4 a').removeClass('current').addClass('done');
|
44
|
+
$('#checkout_nav5 a').removeClass('not_done').addClass('current');
|
45
|
+
$('#confirm_card_number').html("Card ending in " + cc.substr(-4));
|
46
|
+
$('#checkout-continue button').html("Confirm order");
|
47
|
+
self.is_confirm = true;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
else
|
51
|
+
{
|
52
|
+
$('#message').html("<p class='loading'>Processing payment...</p>");
|
53
|
+
$('form#payment').submit();
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
self.edit_payment_handler = function(event) {
|
58
|
+
$('#checkout-confirm').hide();
|
59
|
+
$('#checkout-payment').show();
|
60
|
+
$('#checkout_nav4 a').removeClass('done').addClass('current');
|
61
|
+
$('#checkout_nav5 a').removeClass('current').addClass('not_done');
|
62
|
+
$('#checkout-continue button').html("Continue");
|
63
|
+
self.is_confirm = false;
|
64
|
+
};
|
65
|
+
|
66
|
+
//self.relay_handler = function(event) {
|
67
|
+
// alert('Relay handler');
|
68
|
+
// var iframe = $('#relay');
|
69
|
+
// var form = $('#payment');
|
70
|
+
// var resp = iframe.contents().find('#response');
|
71
|
+
//
|
72
|
+
// if (!resp.length || form.length)
|
73
|
+
// {
|
74
|
+
// alert('No response found.');
|
75
|
+
// return false;
|
76
|
+
// }
|
77
|
+
//
|
78
|
+
// resp = JSON.parse(resp.html());
|
79
|
+
// if (resp.error)
|
80
|
+
// $('#message').html("<p class='note error'>" + resp.error + "</p>");
|
81
|
+
// else if (resp.success == true)
|
82
|
+
// window.location = '/checkout/thanks';
|
83
|
+
//};
|
84
|
+
|
85
|
+
return self
|
86
|
+
}).call(Caboose.Store);
|
87
|
+
|
88
|
+
function relay_handler(resp)
|
89
|
+
{
|
90
|
+
console.log('RELAY');
|
91
|
+
if (resp.success == true)
|
92
|
+
window.location = '/checkout/thanks';
|
93
|
+
else if (resp.message)
|
94
|
+
$('#message').html("<p class='note error'>" + resp.message + "</p>");
|
95
|
+
else
|
96
|
+
$('#message').html("<p class='note error'>There was an error processing your payment.</p>");
|
97
|
+
}
|
@@ -1,13 +1,6 @@
|
|
1
1
|
//
|
2
|
-
//
|
2
|
+
// Caboose
|
3
3
|
//
|
4
|
-
// :: Initialize
|
5
|
-
// :: Events
|
6
|
-
// :: Redirect
|
7
|
-
// :: Reload
|
8
|
-
// :: Login
|
9
|
-
// :: Logout
|
10
|
-
// :: Register
|
11
4
|
|
12
5
|
var Caboose = function() {
|
13
6
|
var self = this;
|
@@ -124,3 +117,101 @@ var Caboose = function() {
|
|
124
117
|
|
125
118
|
// There can only be one
|
126
119
|
var Caboose = new Caboose();
|
120
|
+
|
121
|
+
//
|
122
|
+
// Caboose Store
|
123
|
+
//
|
124
|
+
|
125
|
+
Caboose.Store = (function(caboose) {
|
126
|
+
var self = {
|
127
|
+
Modules: {}
|
128
|
+
};
|
129
|
+
|
130
|
+
self.initialize = function() {
|
131
|
+
_.each(self.Modules, function(module) {
|
132
|
+
if (module.initialize) module.initialize();
|
133
|
+
});
|
134
|
+
};
|
135
|
+
|
136
|
+
$(document).ready(self.initialize);
|
137
|
+
return self;
|
138
|
+
}).call(Caboose);
|
139
|
+
|
140
|
+
//
|
141
|
+
// Delay
|
142
|
+
//
|
143
|
+
|
144
|
+
var delay = (function() {
|
145
|
+
var timer = 0;
|
146
|
+
|
147
|
+
return function(callback, ms) {
|
148
|
+
clearTimeout(timer);
|
149
|
+
timer = setTimeout(callback, ms);
|
150
|
+
};
|
151
|
+
})();
|
152
|
+
|
153
|
+
//
|
154
|
+
// States
|
155
|
+
//
|
156
|
+
|
157
|
+
window.States = {
|
158
|
+
"AL": "Alabama",
|
159
|
+
"AK": "Alaska",
|
160
|
+
"AS": "American Samoa",
|
161
|
+
"AZ": "Arizona",
|
162
|
+
"AR": "Arkansas",
|
163
|
+
"CA": "California",
|
164
|
+
"CO": "Colorado",
|
165
|
+
"CT": "Connecticut",
|
166
|
+
"DE": "Delaware",
|
167
|
+
"DC": "District Of Columbia",
|
168
|
+
"FM": "Federated States Of Micronesia",
|
169
|
+
"FL": "Florida",
|
170
|
+
"GA": "Georgia",
|
171
|
+
"GU": "Guam",
|
172
|
+
"HI": "Hawaii",
|
173
|
+
"ID": "Idaho",
|
174
|
+
"IL": "Illinois",
|
175
|
+
"IN": "Indiana",
|
176
|
+
"IA": "Iowa",
|
177
|
+
"KS": "Kansas",
|
178
|
+
"KY": "Kentucky",
|
179
|
+
"LA": "Louisiana",
|
180
|
+
"ME": "Maine",
|
181
|
+
"MH": "Marshall Islands",
|
182
|
+
"MD": "Maryland",
|
183
|
+
"MA": "Massachusetts",
|
184
|
+
"MI": "Michigan",
|
185
|
+
"MN": "Minnesota",
|
186
|
+
"MS": "Mississippi",
|
187
|
+
"MO": "Missouri",
|
188
|
+
"MT": "Montana",
|
189
|
+
"NE": "Nebraska",
|
190
|
+
"NV": "Nevada",
|
191
|
+
"NH": "New Hampshire",
|
192
|
+
"NJ": "New Jersey",
|
193
|
+
"NM": "New Mexico",
|
194
|
+
"NY": "New York",
|
195
|
+
"NC": "North Carolina",
|
196
|
+
"ND": "North Dakota",
|
197
|
+
"MP": "Northern Mariana Islands",
|
198
|
+
"OH": "Ohio",
|
199
|
+
"OK": "Oklahoma",
|
200
|
+
"OR": "Oregon",
|
201
|
+
"PW": "Palau",
|
202
|
+
"PA": "Pennsylvania",
|
203
|
+
"PR": "Puerto Rico",
|
204
|
+
"RI": "Rhode Island",
|
205
|
+
"SC": "South Carolina",
|
206
|
+
"SD": "South Dakota",
|
207
|
+
"TN": "Tennessee",
|
208
|
+
"TX": "Texas",
|
209
|
+
"UT": "Utah",
|
210
|
+
"VT": "Vermont",
|
211
|
+
"VI": "Virgin Islands",
|
212
|
+
"VA": "Virginia",
|
213
|
+
"WA": "Washington",
|
214
|
+
"WV": "West Virginia",
|
215
|
+
"WI": "Wisconsin",
|
216
|
+
"WY": "Wyoming"
|
217
|
+
};
|