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,11 @@
|
|
1
|
+
<h1>Categories</h1>
|
2
|
+
<a href='/admin/categories/new'>New Category</a>
|
3
|
+
<%= category_list %>
|
4
|
+
|
5
|
+
<% content_for :caboose_js do %>
|
6
|
+
<script type='text/javascript'>
|
7
|
+
$(document).ready(function() {
|
8
|
+
var modal = new CabooseModal(800);
|
9
|
+
});
|
10
|
+
</script>
|
11
|
+
<% end %>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<h1>New Category</h1>
|
2
|
+
|
3
|
+
<form action="/admin/categories" method="post" id="new_form">
|
4
|
+
<!-- <select name="parent_id">
|
5
|
+
<option value="">-- Parent Category --</option>
|
6
|
+
<%=
|
7
|
+
#raw categories_options(@root_category)
|
8
|
+
%>
|
9
|
+
</select> -->
|
10
|
+
|
11
|
+
<%= category_select('parent_id') %>
|
12
|
+
|
13
|
+
<input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>" />
|
14
|
+
<input type="text" name="name" placeholder="Category Name" />
|
15
|
+
|
16
|
+
<div id="message"></div>
|
17
|
+
|
18
|
+
<input type="button" value="< Back" onclick="window.location='/admin/categories';" />
|
19
|
+
<input type="submit" value="Add Category" onclick="add_category(); return false" />
|
20
|
+
</form>
|
21
|
+
|
22
|
+
<% content_for :caboose_css do %>
|
23
|
+
<style>
|
24
|
+
form { width: 400px; }
|
25
|
+
form input[type=text], select { width: 100%; }
|
26
|
+
form input[type=text] {
|
27
|
+
box-sizing: border-box;
|
28
|
+
margin: 12px 0;
|
29
|
+
height: 42px;
|
30
|
+
line-height: 42px;
|
31
|
+
}
|
32
|
+
select,
|
33
|
+
form input[type=button],
|
34
|
+
form input[type=submit] { cursor: pointer; }
|
35
|
+
</style>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<% content_for :caboose_js do %>
|
39
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
40
|
+
|
41
|
+
<script type='text/javascript'>
|
42
|
+
function add_category() {
|
43
|
+
modal.autosize("<p class='loading'>Adding category...</p>");
|
44
|
+
|
45
|
+
$.ajax({
|
46
|
+
url: '/admin/categories',
|
47
|
+
type: 'post',
|
48
|
+
data: $('#new_form').serialize(),
|
49
|
+
success: function(resp) {
|
50
|
+
if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
|
51
|
+
if (resp.redirect) window.location = resp.redirect
|
52
|
+
}
|
53
|
+
});
|
54
|
+
}
|
55
|
+
|
56
|
+
var modal = false;
|
57
|
+
|
58
|
+
$(window).load(function() {
|
59
|
+
modal = new CabooseModal(800);
|
60
|
+
});
|
61
|
+
</script>
|
62
|
+
<% end %>
|
@@ -0,0 +1,111 @@
|
|
1
|
+
<% if logged_in? %>
|
2
|
+
<form action="/checkout/shipping" method="post" id="address">
|
3
|
+
<section>
|
4
|
+
<fieldset id="shipping">
|
5
|
+
<h3>Shipping Address</h3>
|
6
|
+
|
7
|
+
<table>
|
8
|
+
<div>
|
9
|
+
<label for="shipping-first-name">First Name:</label>
|
10
|
+
<input id="shipping-first-name" name="shipping[first_name]" type="text" value="<%= @order.shipping_address.first_name if @order.shipping_address %>" />
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div>
|
14
|
+
<label for="shipping-last-name">Last Name:</label>
|
15
|
+
<input id="shipping-last-name" name="shipping[last_name]" type="text" value="<%= @order.shipping_address.last_name if @order.shipping_address %>" />
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div>
|
19
|
+
<label for="shipping-company">Company:</label>
|
20
|
+
<input id="shipping-company" name="shipping[company]" type="text" value="<%= @order.shipping_address.company if @order.shipping_address and @order.shipping_address.company %>" />
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div>
|
24
|
+
<label for="shipping-address1">Address 1:</label>
|
25
|
+
<input id="shipping-address1" name="shipping[address1]" type="text" value="<%= @order.shipping_address.address1 if @order.shipping_address %>" />
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div>
|
29
|
+
<label for="shipping-address2">Address 2:</label>
|
30
|
+
<input id="shipping-address2" name="shipping[address2]" type="text" value="<%= @order.shipping_address.address2 if @order.shipping_address %>" />
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div>
|
34
|
+
<label for="shipping-city">City:</label>
|
35
|
+
<input id="shipping-city" name="shipping[city]" type="text" value="<%= @order.shipping_address.city if @order.shipping_address %>" />
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div>
|
39
|
+
<label for="shipping-state">State:</label>
|
40
|
+
<select id="shipping-state" name="shipping[state]">
|
41
|
+
<% Caboose::States.all.each do |abbr, name| %>
|
42
|
+
<option value="<%= abbr %>"><%= name %></option>
|
43
|
+
<% end %>
|
44
|
+
</select>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div>
|
48
|
+
<label for="shipping-zip">Zip:</label>
|
49
|
+
<input id="shipping-zip" name="shipping[zip]" type="text" value="<%= @order.shipping_address.zip if @order.shipping_address %>" />
|
50
|
+
</div>
|
51
|
+
|
52
|
+
<label>Use as billing:</label>
|
53
|
+
<input id="use-as-billing" name="shipping[use_as_billing]" type="checkbox" checked />
|
54
|
+
</table>
|
55
|
+
</fieldset>
|
56
|
+
|
57
|
+
<fieldset id="billing">
|
58
|
+
<h3>Billing Address</h3>
|
59
|
+
|
60
|
+
<table>
|
61
|
+
<div>
|
62
|
+
<label for="billing-first-name">First Name:</label>
|
63
|
+
<input id="billing-first-name" name="billing[first_name]" type="text" value="<%= @order.billing_address.first_name if @order.billing_address %>" />
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<div>
|
67
|
+
<label for="billing-last-name">Last Name:</label>
|
68
|
+
<input id="billing-last-name" name="billing[last_name]" type="text" value="<%= @order.billing_address.last_name if @order.billing_address %>" />
|
69
|
+
</div>
|
70
|
+
|
71
|
+
<div>
|
72
|
+
<label for="billing-company">Company:</label>
|
73
|
+
<input id="billing-company" name="billing[company]" type="text" value="<%= @order.billing_address.company if @order.billing_address and @order.billing_address.company %>" />
|
74
|
+
</div>
|
75
|
+
|
76
|
+
<div>
|
77
|
+
<label for="billing-address1">Address 1:</label>
|
78
|
+
<input id="billing-address1" name="billing[address1]" type="text" value="<%= @order.billing_address.address1 if @order.billing_address %>" />
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<div>
|
82
|
+
<label for="billing-address2">Address 2:</label>
|
83
|
+
<input id="billing-address2" name="billing[address2]" type="text" value="<%= @order.billing_address.address2 if @order.billing_address %>" />
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div>
|
87
|
+
<label for="billing-city">City:</label>
|
88
|
+
<input id="billing-city" name="billing[city]" type="text" value="<%= @order.billing_address.city if @order.billing_address %>" />
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div>
|
92
|
+
<label for="">State:</label>
|
93
|
+
<select name="billing[state]">
|
94
|
+
<% Caboose::States.all.each do |abbr, name| %>
|
95
|
+
<option value="<%= abbr %>"><%= name %></option>
|
96
|
+
<% end %>
|
97
|
+
</select>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
<div>
|
101
|
+
<label for="">Zip:</label>
|
102
|
+
<input id="billing-zip" name="billing[zip]" type="text" value="<%= @order.billing_address.zip if @order.billing_address %>" />
|
103
|
+
</div>
|
104
|
+
</table>
|
105
|
+
</fieldset>
|
106
|
+
</section>
|
107
|
+
|
108
|
+
<div id="message"></div>
|
109
|
+
<input type="submit" value="Continue >" />
|
110
|
+
</form>
|
111
|
+
<% end %>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<% if @order.discounts.any? && @order.total < @order.discounts.first.amount_current %>
|
2
|
+
<p style="margin: 24px 0 0">Gift Card covers purchase.</p>
|
3
|
+
<button onclick="window.location='/checkout/discount'" style="margin: 12px 0 0">< Back</button>
|
4
|
+
<button onclick="window.location='/checkout/authorize-by-gift-card'" style="margin: 12px 0 0">Continue ></button>
|
5
|
+
<% else %>
|
6
|
+
<input id="billing-amount" type="hidden" value="<%= @order.total %>" />
|
7
|
+
|
8
|
+
<form id="billing-form" action="<%= @form_url %>" method="post" target="payment-request">
|
9
|
+
<input name="billing-cc-exp" type="hidden" value="01<%= DateTime.now.year.to_s[2..4] %>" />
|
10
|
+
|
11
|
+
<div>
|
12
|
+
<label for="billing-number">Card number:</label>
|
13
|
+
<input id="billing-number" type="text" name="billing-cc-number" maxlength="16" />
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div>
|
17
|
+
<label for="billing-expiration-month">Expiration:</label>
|
18
|
+
<select id="billing-expiration-month">
|
19
|
+
<option value="01">01 - Jan</option>
|
20
|
+
<option value="02">02 - Feb</option>
|
21
|
+
<option value="03">03 - Mar</option>
|
22
|
+
<option value="04">04 - Apr</option>
|
23
|
+
<option value="05">05 - May</option>
|
24
|
+
<option value="06">06 - Jun</option>
|
25
|
+
<option value="07">07 - Jul</option>
|
26
|
+
<option value="08">08 - Aug</option>
|
27
|
+
<option value="09">09 - Sep</option>
|
28
|
+
<option value="10">10 - Oct</option>
|
29
|
+
<option value="11">11 - Nov</option>
|
30
|
+
<option value="12">12 - Dec</option>
|
31
|
+
</select>
|
32
|
+
/
|
33
|
+
<select id="billing-expiration-year" name="exp_year">
|
34
|
+
<% (DateTime.now.year...DateTime.now.year + 20).each do |i| %>
|
35
|
+
<option value="<%= i-2000 %>"><%= i %></option>
|
36
|
+
<% end %>
|
37
|
+
</select>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<input type="button" value="< Back" onclick="window.location='/checkout/discount';" />
|
41
|
+
<input type="submit" value="Continue >" />
|
42
|
+
</form>
|
43
|
+
|
44
|
+
<p><a href="/checkout/discount"><%= if @order.discounts.any? then 'Update Gift Card' else 'Add Gift Card' end %></a></p>
|
45
|
+
|
46
|
+
<iframe style="display: none" id="payment-request" name="payment-request"></iframe>
|
47
|
+
<% end %>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<table id="cart">
|
2
|
+
<tr>
|
3
|
+
<th>Item</th>
|
4
|
+
<th>Quantity</th>
|
5
|
+
<th>Subtotal</th>
|
6
|
+
</tr>
|
7
|
+
|
8
|
+
<% @order.line_items.each do |line_item| %>
|
9
|
+
<tr>
|
10
|
+
<td>
|
11
|
+
<%= line_item.variant.product.title %> - <%= line_item.variant.title %>
|
12
|
+
|
13
|
+
<% line_item.customizations.each do |customization| %>
|
14
|
+
<p><%= "- #{customization.variant.product.custom_input}: #{customization.custom_input}"%></p>
|
15
|
+
<% end %>
|
16
|
+
</td>
|
17
|
+
<td align="right"><%= line_item.quantity %></td>
|
18
|
+
<td align="right"><%= number_to_currency(line_item.subtotal) %></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<tr>
|
23
|
+
<td colspan="2" align="right">Subtotal</td>
|
24
|
+
<td align="right"><%= number_to_currency(@order.subtotal) %></td>
|
25
|
+
</tr>
|
26
|
+
|
27
|
+
<% if @order.tax and @order.tax > 0 %>
|
28
|
+
<tr>
|
29
|
+
<td colspan="2" align="right">Tax <span class="float: right">+</span></td>
|
30
|
+
<td align="right"><%= number_to_currency(@order.tax) %></td>
|
31
|
+
</tr>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<% if @order.shipping and @order.handling %>
|
35
|
+
<tr>
|
36
|
+
<td colspan="2" align="right">Shipping & Handling <span class="float: right">+</span></td>
|
37
|
+
<td align="right"><%= number_to_currency(@order.shipping + @order.handling) %></td>
|
38
|
+
</tr>
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
<% if @order.discounts.any? %>
|
42
|
+
<tr>
|
43
|
+
<td colspan="2" align="right">Gift Card <span class="float: right">-</span></td>
|
44
|
+
<td align="right"><%= number_to_currency(@order.discounts.first.amount_current) %></td>
|
45
|
+
</tr>
|
46
|
+
<% end %>
|
47
|
+
|
48
|
+
<tr>
|
49
|
+
<td colspan="2" align="right">Total <span class="float: right">=</span></td>
|
50
|
+
<td align="right"><%= number_to_currency(@order.total) %></td>
|
51
|
+
</tr>
|
52
|
+
</table>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<section id='checkout-confirm'>
|
2
|
+
<div class='wrapper'>
|
3
|
+
<section id="line-items">
|
4
|
+
<table>
|
5
|
+
<tr>
|
6
|
+
<th>Product</th>
|
7
|
+
<th>Quantity</th>
|
8
|
+
<th>Unit Price</th>
|
9
|
+
<th>Subtotal</th>
|
10
|
+
</tr>
|
11
|
+
<% @order.line_items.each do |li| %>
|
12
|
+
<tr data-id="<%= li.id %>">
|
13
|
+
<td valign='top'>
|
14
|
+
<% if li.variant.product_images.count > 0 %>
|
15
|
+
<figure style="background-image: url(<%= li.variant.product_images[0].image.url(:thumb) %>)"></figure>
|
16
|
+
<% end %>
|
17
|
+
<p><%= li.title %></p>
|
18
|
+
</td>
|
19
|
+
<td valign='top' align='right' class='qty' ><%= li.quantity %></td>
|
20
|
+
<td valign='top' align='right' class='price' ><%= number_to_currency(li.price, :precision => 2) %></td>
|
21
|
+
<td valign='top' align='right' class='subtotal'><%= number_to_currency(li.price, :precision => 2) %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
<tr><td colspan='3' align='right'>Subtotal: </td><td align='right'><%= number_to_currency(@order.subtotal, :precision => 2) %></td></tr>
|
25
|
+
<tr><td colspan='3' align='right'>Shipping & Handling: </td><td align='right'><%= number_to_currency(@order.shipping + @order.handling, :precision => 2) %></td></tr>
|
26
|
+
<% if @order.tax > 0 && @order.billing_address.state == 'AL' %>
|
27
|
+
<tr><td colspan='3' align='right'>Tax <small>(if in Alabama)</small>: </td><td align='right'><%= number_to_currency(@order.tax, :precision => 2) %></td></tr>
|
28
|
+
<% end %>
|
29
|
+
<tr><td colspan='3' align='right'>Total: </td><td align='right'><%= number_to_currency(@order.total, :precision => 2) %></td></tr>
|
30
|
+
</table>
|
31
|
+
</section>
|
32
|
+
<section id='shipping_address'>
|
33
|
+
<% sa = @order.shipping_address %>
|
34
|
+
<address>
|
35
|
+
<%= "#{sa.first_name} #{sa.last_name}" %><br />
|
36
|
+
<%= sa.address1 %><br />
|
37
|
+
<%= "#{sa.address2}<br />" if sa.address2 and not sa.address2.empty? %>
|
38
|
+
<%= "#{sa.city}, #{sa.state} #{sa.zip}" %>
|
39
|
+
</address>
|
40
|
+
<p><a href="/checkout/step-two">Edit shipping address</a></p>
|
41
|
+
</section>
|
42
|
+
<section id='billing_address'>
|
43
|
+
<% ba = @order.billing_address %>
|
44
|
+
<address>
|
45
|
+
<%= "#{ba.first_name} #{ba.last_name}" %><br />
|
46
|
+
<%= ba.address1 %><br />
|
47
|
+
<%= "#{ba.address2}<br />" if ba.address2 and not ba.address2.empty? %>
|
48
|
+
<%= "#{ba.city}, #{ba.state} #{ba.zip}" %>
|
49
|
+
</address>
|
50
|
+
<p><a href="/checkout/step-two">Edit billing address</a></p>
|
51
|
+
</section>
|
52
|
+
<section id='shipping_method'>
|
53
|
+
<p><%= @order.shipping_method %> - <%= number_to_currency(@order.shipping) %></p>
|
54
|
+
<p><a href="/checkout/step-three">Edit shipping method</a></p>
|
55
|
+
</section>
|
56
|
+
<section id='payment_method'>
|
57
|
+
<p id='confirm_card_number'></p>
|
58
|
+
<p><a href="#" id='edit_payment'>Edit payment</a></p>
|
59
|
+
</section>
|
60
|
+
</div>
|
61
|
+
</section>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<form id="discounts">
|
2
|
+
<label for="gift-card" style="margin: 0 0 12px">Gift Card Number:</label>
|
3
|
+
<input id="gift-card" name="gift_card_number" type="text" placeholder="<%= @order.discounts.first.code if @order.discounts.any? %>" maxlength="8" />
|
4
|
+
<div id="message"></div>
|
5
|
+
|
6
|
+
<input id="back" type="button" value="< Back" onclick="window.location='/checkout/shipping'" />
|
7
|
+
<input id="next" type="submit" value="<%= if @order.discounts.any? then 'Update' else 'Add' end %>" />
|
8
|
+
<input id="skip" type="button" value="<%= if @order.discounts.any? then 'Continue >' else 'Skip >' end %>" onclick="window.location='/checkout/billing'" />
|
9
|
+
</form>
|
10
|
+
|
11
|
+
<% content_for :caboose_js do %>
|
12
|
+
<script>
|
13
|
+
$(document).ready(function() {
|
14
|
+
var $form = $('#discounts');
|
15
|
+
|
16
|
+
$form.on('submit', function(event) {
|
17
|
+
event.preventDefault();
|
18
|
+
|
19
|
+
$.ajax({
|
20
|
+
url: '/checkout/discount',
|
21
|
+
type: 'post',
|
22
|
+
data: $form.serialize(),
|
23
|
+
success: function(response) {
|
24
|
+
console.log(response);
|
25
|
+
|
26
|
+
if (response.success) {
|
27
|
+
$('#next').empty().val('Update')
|
28
|
+
$('#skip').empty().val('Continue >');
|
29
|
+
$('#message').removeClass('error').addClass('success');
|
30
|
+
} else {
|
31
|
+
$('#message').removeClass('success').addClass('error');
|
32
|
+
}
|
33
|
+
|
34
|
+
$('#message').empty().text(response.message);
|
35
|
+
}
|
36
|
+
});
|
37
|
+
});
|
38
|
+
});
|
39
|
+
</script>
|
40
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% @shipping_address ||= @order.shipping_address %>
|
2
|
+
|
3
|
+
<address>
|
4
|
+
<%= "#{@shipping_address.first_name} #{@shipping_address.last_name}" %><br />
|
5
|
+
<%= @shipping_address.address1 %><br />
|
6
|
+
<%= "#{@shipping_address.address2}" if @shipping_address.address2 and not @shipping_address.address2.empty? %><br />
|
7
|
+
<%= "#{@shipping_address.city}, #{@shipping_address.state} #{@shipping_address.zip}" %>
|
8
|
+
</address>
|
9
|
+
|
10
|
+
<p><a href="/checkout">Edit shipping address</a></p>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<form id="shipping-rates" action="" method="put">
|
2
|
+
<fieldset>
|
3
|
+
<% @shipping_rates.each do |rate| %>
|
4
|
+
<div>
|
5
|
+
<input id="shipping-method-<%= rate['service_code'] %>" name="shipping_method_code" type="radio" value="<%= rate['service_code'] %>" />
|
6
|
+
<input id="shipping-method-<%= rate['service_code'] %>-name" type="hidden" value="<%= rate['service_name'] %>" />
|
7
|
+
<input id="shipping-method-<%= rate['service_code'] %>-price" type="hidden" value="<%= if rate['negotiated_rate'] and rate['negotiated_rate'] > 0 then rate['negotiated_rate'] else rate['total_price'] end %>" />
|
8
|
+
|
9
|
+
<label for="shipping-method-<%= rate['service_code'] %>">
|
10
|
+
<%= number_to_currency rate['total_price'].to_s.insert(-3, '.') %>
|
11
|
+
<%= rate['service_name'] %>
|
12
|
+
</label>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
</fieldset>
|
16
|
+
|
17
|
+
<div id="message"></div>
|
18
|
+
|
19
|
+
<input type="button" value="< Back" onclick="window.location='/checkout';" />
|
20
|
+
<input type="submit" value="Continue >" />
|
21
|
+
</form>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<h3>Checkout</h3>
|
2
|
+
<%= render :partial => '/caboose/checkout/cart' %>
|
3
|
+
|
4
|
+
<h2>Shipping Address</h2>
|
5
|
+
<%= render :partial => '/caboose/checkout/shipping_address' %>
|
6
|
+
|
7
|
+
<h2>Shipping Method</h2>
|
8
|
+
<%= render :partial => '/caboose/checkout/shipping_method' %>
|
9
|
+
|
10
|
+
<h2>Billing Information</h2>
|
11
|
+
<%= render :partial => '/caboose/checkout/billing_form' %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<h3>Checkout</h3>
|
2
|
+
<%= render :partial => '/caboose/checkout/cart' %>
|
3
|
+
|
4
|
+
<h2>Shipping Address</h2>
|
5
|
+
<%= render :partial => '/caboose/checkout/shipping_address' %>
|
6
|
+
|
7
|
+
<h2>Shipping Method</h2>
|
8
|
+
<%= render :partial => '/caboose/checkout/shipping_method' %>
|
9
|
+
|
10
|
+
<h2>Discount</h2>
|
11
|
+
<%= render :partial => '/caboose/checkout/order_discount' %>
|