caboose-cms 0.5.69 → 0.5.70

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +8 -8
  2. data/app/assets/javascripts/caboose/admin.js +2 -1
  3. data/app/assets/javascripts/caboose/admin_edit_order.js +0 -13
  4. data/app/assets/javascripts/caboose/admin_main.js +13 -0
  5. data/app/assets/javascripts/caboose/cart.js +145 -161
  6. data/app/assets/javascripts/caboose/cart_old.js +176 -0
  7. data/app/assets/javascripts/caboose/checkout.js +1 -1
  8. data/app/assets/javascripts/caboose/{checkout_step2.js → checkout_addresses.js} +3 -3
  9. data/app/assets/javascripts/caboose/checkout_gift_cards.js +47 -0
  10. data/app/assets/javascripts/caboose/{checkout_step1.js → checkout_login_register.js} +5 -53
  11. data/app/assets/javascripts/caboose/checkout_module.js +3 -4
  12. data/app/assets/javascripts/caboose/{checkout_step4.js → checkout_payment.js} +8 -8
  13. data/app/assets/javascripts/caboose/{checkout_step3.js → checkout_shipping.js} +5 -5
  14. data/app/assets/javascripts/caboose/imageZoom.js +66 -0
  15. data/app/assets/javascripts/caboose/model/attribute.js +2 -1
  16. data/app/assets/javascripts/caboose/model/bound_select.js +15 -6
  17. data/app/assets/javascripts/caboose/product.js +12 -2
  18. data/app/assets/stylesheets/caboose/checkout.css.scss +1 -0
  19. data/app/assets/templates/caboose/checkout/address.jst.ejs +1 -1
  20. data/app/controllers/caboose/cart_controller.rb +60 -8
  21. data/app/controllers/caboose/checkout_controller.rb +42 -71
  22. data/app/controllers/caboose/gift_cards_controller.rb +216 -0
  23. data/app/controllers/caboose/users_controller.rb +2 -2
  24. data/app/helpers/caboose/checkout_helper.rb +6 -5
  25. data/app/models/caboose/core_plugin.rb +2 -1
  26. data/app/models/caboose/discount.rb +8 -13
  27. data/app/models/caboose/gift_card.rb +49 -0
  28. data/app/models/caboose/order.rb +66 -46
  29. data/app/models/caboose/order_package.rb +11 -4
  30. data/app/models/caboose/order_package_calculator.rb +102 -0
  31. data/app/models/caboose/product_image.rb +10 -0
  32. data/app/models/caboose/schema.rb +38 -29
  33. data/app/models/caboose/shipping_calculator.rb +4 -2
  34. data/app/models/caboose/shipping_package.rb +7 -0
  35. data/app/views/caboose/cart/index.html.erb +12 -2
  36. data/app/views/caboose/checkout/#Untitled-1# +2 -0
  37. data/app/views/caboose/checkout/_cart.html.erb +45 -48
  38. data/app/views/caboose/checkout/_cart_old.html.erb +49 -0
  39. data/app/views/caboose/checkout/_confirm.html.erb +6 -4
  40. data/app/views/caboose/checkout/_confirm_table.html.erb +0 -0
  41. data/app/views/caboose/checkout/{step_two.html.erb → addresses.html.erb} +2 -2
  42. data/app/views/caboose/checkout/gift_cards.html.erb +35 -0
  43. data/app/views/caboose/checkout/index.html.erb +53 -42
  44. data/app/views/caboose/checkout/payment.html.erb +108 -75
  45. data/app/views/caboose/checkout/shipping.html.erb +62 -13
  46. data/app/views/caboose/gift_cards/admin_edit.html.erb +89 -0
  47. data/app/views/caboose/gift_cards/admin_index.html.erb +52 -0
  48. data/config/routes.rb +39 -19
  49. data/lib/caboose/engine.rb +1 -0
  50. data/lib/caboose/version.rb +1 -1
  51. metadata +20 -14
  52. data/app/assets/javascripts/caboose/cart2.js +0 -98
  53. data/app/views/caboose/checkout/step_four.html.erb +0 -67
  54. data/app/views/caboose/checkout/step_four_old.html.erb +0 -63
  55. data/app/views/caboose/checkout/step_one.html.erb +0 -54
  56. data/app/views/caboose/checkout/step_one_old.html.erb +0 -13
  57. data/app/views/caboose/checkout/step_three.html.erb +0 -55
  58. data/app/views/caboose/checkout/step_two_old.html.erb +0 -14
@@ -43,8 +43,10 @@ module Caboose
43
43
  if sp.uses_carrier(name)
44
44
  resp = carrier.find_rates(origin, destination, package)
45
45
  resp.rates.sort_by(&:price).each do |rate|
46
- next if !sp.uses_service_code(name, rate.service_code)
47
- rates << { :carrier => name, :service_code => rate.service_code, :service_name => rate.service_name, :price => rate.total_price.to_d / 100 }
46
+ sm = ShippingMethod.where(:carrier => name, :service_code => rate.service_code).first
47
+ sm = ShippingMethod.create(:carrier => name, :service_code => rate.service_code, :service_name => rate.service_name) if sm.nil?
48
+ next if !sp.uses_shipping_method(sm)
49
+ rates << { :shipping_method => sm, :price => rate.total_price.to_d / 100 }
48
50
  end
49
51
  end
50
52
  end
@@ -126,6 +126,13 @@ module Caboose
126
126
  end
127
127
  return false
128
128
  end
129
+
130
+ def uses_shipping_method(sm)
131
+ self.shipping_methods.each do |sm2|
132
+ return true if sm.id == sm2.id
133
+ end
134
+ return false
135
+ end
129
136
 
130
137
  end
131
138
  end
@@ -1,5 +1,9 @@
1
1
  <div class="constrain">
2
2
  <div id='cart'></div>
3
+ <p class='controls'>
4
+ <input type='button' value='Continue Shopping' onclick="window.location='/products';" />
5
+ <input type='button' value='Checkout' onclick="window.location='/checkout';" />
6
+ </p>
3
7
  </div>
4
8
 
5
9
  <% content_for :caboose_css do %>
@@ -10,11 +14,17 @@
10
14
 
11
15
  <% content_for :caboose_js do %>
12
16
  <%= javascript_include_tag 'caboose/model/all' %>
13
- <%= javascript_include_tag 'caboose/cart2' %>
17
+ <%= javascript_include_tag 'caboose/cart' %>
14
18
  <script type='text/javascript'>
15
19
 
16
20
  $(document).ready(function() {
17
- var controller = new Cart();
21
+ var controller = new Cart({
22
+ allow_edit: true,
23
+ show_shipping: false,
24
+ show_tax: false,
25
+ show_discounts: false,
26
+ show_total: false
27
+ });
18
28
  });
19
29
 
20
30
  </script>
@@ -1,49 +1,46 @@
1
1
 
2
- <div class='constrain'>
3
- <table id="cart">
4
- <tr>
5
- <th>Item</th>
6
- <th>Quantity</th>
7
- <th>Subtotal</th>
8
- </tr>
9
- <% @order.line_items.each do |line_item| %>
10
- <tr>
11
- <td>
12
- <%= line_item.variant.product.title %> - <%= line_item.variant.title %>
13
-
14
- <% line_item.customizations.each do |customization| %>
15
- <p><%= "- #{customization.variant.product.custom_input}: #{customization.custom_input}"%></p>
16
- <% end %>
17
- </td>
18
- <td align="right"><%= line_item.quantity %></td>
19
- <td align="right"><%= number_to_currency(line_item.subtotal) %></td>
20
- </tr>
21
- <% end %>
22
- <tr>
23
- <td colspan="2" align="right">Subtotal</td>
24
- <td align="right"><%= number_to_currency(@order.subtotal) %></td>
25
- </tr>
26
- <% if @order.tax and @order.tax > 0 %>
27
- <tr>
28
- <td colspan="2" align="right">Tax <span class="float: right">+</span></td>
29
- <td align="right"><%= number_to_currency(@order.tax) %></td>
30
- </tr>
31
- <% end %>
32
- <% if @order.shipping and @order.handling %>
33
- <tr>
34
- <td colspan="2" align="right">Shipping &amp; Handling <span class="float: right">+</span></td>
35
- <td align="right"><%= number_to_currency(@order.shipping + @order.handling) %></td>
36
- </tr>
37
- <% end %>
38
- <% if @order.discounts.any? %>
39
- <tr>
40
- <td colspan="2" align="right">Gift Card <span class="float: right">-</span></td>
41
- <td align="right"><%= number_to_currency(@order.discounts.first.amount_current) %></td>
42
- </tr>
43
- <% end %>
44
- <tr>
45
- <td colspan="2" align="right">Total <span class="float: right">=</span></td>
46
- <td align="right"><%= number_to_currency(@order.total) %></td>
47
- </tr>
48
- </table>
49
- </div>
2
+ <table class='cart'>
3
+ <tr>
4
+ <th colspan='2'>Product</th>
5
+ <th>Quantity</th>
6
+ <th>Unit Price</th>
7
+ <th>Subtotal</th>
8
+ </tr>
9
+ <% @order.line_items.each do |li| %>
10
+ <tr data-id="<%= li.id %>">
11
+ <td valign='top'>
12
+ <% if li.variant.product_images.count > 0 %>
13
+ <img src="<%= li.variant.product_images[0].image.url(:thumb) %>" width="150" />
14
+ <% elsif li.variant.product.product_images.count > 0 %>
15
+ <img src="<%= li.variant.product.product_images[0].image.url(:thumb) %>" width="150" />
16
+ <% end %>
17
+ </td>
18
+ <td valign='top'><%= li.title %></td>
19
+ <td valign='top' align='right' class='qty' style='text-align: right;'><%= li.quantity %></td>
20
+ <td valign='top' align='right' class='price' style='text-align: right;'><%= number_to_currency(li.price, :precision => 2) %></td>
21
+ <td valign='top' align='right' class='subtotal' style='text-align: right;'><%= number_to_currency(li.price, :precision => 2) %></td>
22
+ </tr>
23
+ <% end %>
24
+ <tr><td colspan='4' align='right' style='text-align: right;'>Subtotal: </td><td align='right' style='text-align: right;'><%= number_to_currency(@order.subtotal , :precision => 2) %></td></tr>
25
+ <tr><td colspan='4' align='right' style='text-align: right;'>Shipping & Handling: </td><td align='right' style='text-align: right;'><%= number_to_currency(@order.shipping + @order.handling , :precision => 2) %></td></tr>
26
+ <tr><td colspan='4' align='right' style='text-align: right;'>Tax: </td><td align='right' style='text-align: right;'><%= number_to_currency(@order.tax , :precision => 2) %></td></tr>
27
+ <% if @order.discounts && @order.discounts.count > 0 %>
28
+ <% @order.discounts.each do |d| %>
29
+ <tr>
30
+ <td colspan='4' align='right' style='text-align: right;'>Gift card (<%= d.gift_card.code %>):</td>
31
+ <td align='right' style='text-align: right;'><%= number_to_currency(d.amount, :precision => 2) %></td>
32
+ </tr>
33
+ <% end %>
34
+ <% end %>
35
+ <tr><td colspan='4' align='right' style='text-align: right;'>Total: </td><td align='right' style='text-align: right;'><%= number_to_currency(@order.total , :precision => 2) %></td></tr>
36
+ </table>
37
+
38
+ <% content_for :caboose_css do %>
39
+ <style type='text/css'>
40
+
41
+ table.cart { border-collapse: collapse; width: 100%; margin-bottom: 10px; }
42
+ table.cart th { border: #ccc 1px solid; margin: 0; padding: 10px; text-align: center; font-weight: bold; color: #fff; background-image: url("//d9hjv462jiw15.cloudfront.net/assets/lockerroom/images/body_bg.jpg"); }
43
+ table.cart td { border: #ccc 1px solid; margin: 0; padding: 10px; }
44
+
45
+ </style>
46
+ <% end %>
@@ -0,0 +1,49 @@
1
+
2
+ <div class='constrain'>
3
+ <table id="cart">
4
+ <tr>
5
+ <th>Item</th>
6
+ <th>Quantity</th>
7
+ <th>Subtotal</th>
8
+ </tr>
9
+ <% @order.line_items.each do |line_item| %>
10
+ <tr>
11
+ <td>
12
+ <%= line_item.variant.product.title %> - <%= line_item.variant.title %>
13
+
14
+ <% line_item.customizations.each do |customization| %>
15
+ <p><%= "- #{customization.variant.product.custom_input}: #{customization.custom_input}"%></p>
16
+ <% end %>
17
+ </td>
18
+ <td align="right"><%= line_item.quantity %></td>
19
+ <td align="right"><%= number_to_currency(line_item.subtotal) %></td>
20
+ </tr>
21
+ <% end %>
22
+ <tr>
23
+ <td colspan="2" align="right">Subtotal</td>
24
+ <td align="right"><%= number_to_currency(@order.subtotal) %></td>
25
+ </tr>
26
+ <% if @order.tax and @order.tax > 0 %>
27
+ <tr>
28
+ <td colspan="2" align="right">Tax <span class="float: right">+</span></td>
29
+ <td align="right"><%= number_to_currency(@order.tax) %></td>
30
+ </tr>
31
+ <% end %>
32
+ <% if @order.shipping and @order.handling %>
33
+ <tr>
34
+ <td colspan="2" align="right">Shipping &amp; Handling <span class="float: right">+</span></td>
35
+ <td align="right"><%= number_to_currency(@order.shipping + @order.handling) %></td>
36
+ </tr>
37
+ <% end %>
38
+ <% if @order.discounts.any? %>
39
+ <tr>
40
+ <td colspan="2" align="right">Gift Card <span class="float: right">-</span></td>
41
+ <td align="right"><%= number_to_currency(@order.discounts.first.amount_current) %></td>
42
+ </tr>
43
+ <% end %>
44
+ <tr>
45
+ <td colspan="2" align="right">Total <span class="float: right">=</span></td>
46
+ <td align="right"><%= number_to_currency(@order.total) %></td>
47
+ </tr>
48
+ </table>
49
+ </div>
@@ -1,6 +1,6 @@
1
1
  <section id='checkout-confirm'>
2
2
  <div class='wrapper'>
3
- <section id="line-items">
3
+ <section id="line-items">
4
4
  <table>
5
5
  <tr>
6
6
  <th>Product</th>
@@ -28,6 +28,8 @@
28
28
  <% end %>
29
29
  <tr><td colspan='3' align='right' style='text-align: right;'>Total: </td><td align='right' style='text-align: right;'><%= number_to_currency(@order.total, :precision => 2) %></td></tr>
30
30
  </table>
31
+ <p><a href='#' id='redeem_gift_card'>Redeem gift card</a></p>
32
+ <div id='gift_card_redemption_form'></div>
31
33
  </section><br />
32
34
  <section id='shipping_address'>
33
35
  <% sa = @order.shipping_address %>
@@ -37,7 +39,7 @@
37
39
  <%= "#{sa.address2}<br />" if sa.address2 and not sa.address2.empty? %>
38
40
  <%= "#{sa.city}, #{sa.state} #{sa.zip}" %>
39
41
  </address>
40
- <p><a href="/checkout/step-two">Edit shipping address</a></p>
42
+ <p><a href="/checkout/addresses">Edit shipping address</a></p>
41
43
  </section>
42
44
  <section id='billing_address'>
43
45
  <% ba = @order.billing_address %>
@@ -47,11 +49,11 @@
47
49
  <%= "#{ba.address2}<br />" if ba.address2 and not ba.address2.empty? %>
48
50
  <%= "#{ba.city}, #{ba.state} #{ba.zip}" %>
49
51
  </address>
50
- <p><a href="/checkout/step-two">Edit billing address</a></p>
52
+ <p><a href="/checkout/addresses">Edit billing address</a></p>
51
53
  </section>
52
54
  <section id='shipping_method'>
53
55
  <p><%= @order.shipping_carrier %> <%= @order.shipping_service_name %> - <%= number_to_currency(@order.shipping) %></p>
54
- <p><a href="/checkout/step-three">Edit shipping method</a></p>
56
+ <p><a href="/checkout/shipping">Edit shipping method</a></p>
55
57
  </section>
56
58
  <section id='payment_method'>
57
59
  <p id='confirm_card_number'></p>
@@ -15,7 +15,7 @@ end
15
15
  <% if @logged_in_user.id == 1 %>
16
16
  <p class='note error'>You are logged in as the admin user. Please <a href='/logout'>logout</a> and complete your order as a different user.</p>
17
17
  <% else %>
18
- <form action="/checkout/address" method="put" id='address_form'>
18
+ <form action="/checkout/addresses" method="put" id='address_form'>
19
19
  <section id="checkout-address">
20
20
  <div class="wrapper">
21
21
  <section>
@@ -58,7 +58,7 @@ end
58
58
  </div>
59
59
 
60
60
  <%= content_for :caboose_js do %>
61
- <%= javascript_include_tag 'caboose/checkout_step2' %>
61
+ <%= javascript_include_tag 'caboose/checkout_addresses' %>
62
62
  <% end %>
63
63
  <%= content_for :caboose_css do %>
64
64
  <%= stylesheet_link_tag 'caboose/message_boxes' %>
@@ -0,0 +1,35 @@
1
+
2
+ <div id="checkout">
3
+ <h2>Gift Cards</h2>
4
+
5
+ <p align='center'>
6
+ <input type='text' name='code' id='code' placeholder='Gift card code' style='width: 300px;' />
7
+ <button class="blue" id='redeem_code_btn'>Redeem Code</button>
8
+ <div id='message'></div>
9
+ </p>
10
+ <div id='cart'></div>
11
+
12
+ <section id="checkout-continue">
13
+ <button class="blue">Continue to Payment</button>
14
+ <em>or</em>
15
+ <a href="/">return to the store</a>
16
+ </section>
17
+ </div>
18
+
19
+ <%= content_for :caboose_js do %>
20
+ <%= javascript_include_tag 'caboose/model/all' %>
21
+ <%= javascript_include_tag 'caboose/cart' %>
22
+ <%= javascript_include_tag 'caboose/checkout_gift_cards' %>
23
+ <script type='text/javascript'>
24
+
25
+ var cart = false;
26
+ $(document).ready(function() {
27
+ cart = new Cart({ allow_edit_line_items: false });
28
+ });
29
+
30
+ </script>
31
+ <% end %>
32
+ <%= content_for :caboose_css do %>
33
+ <%= stylesheet_link_tag 'caboose/cart' %>
34
+ <%= stylesheet_link_tag 'caboose/checkout' %>
35
+ <% end %>
@@ -1,43 +1,54 @@
1
- <h3>Checkout2</h3>
2
- <%= render :partial => '/caboose/checkout/cart' %>
3
- <%= render :partial => '/caboose/checkout/address_form' %>
4
-
5
- <% content_for :caboose_css do %>
6
- <style>
7
-
8
- /* Table */
9
-
10
- table#cart { border-collapse: collapse; }
11
- table#cart td { border: #666 1px dotted; padding: 4px 8px; }
12
- table#cart th { font-weight: bold; text-align: center; }
13
-
14
- /* Form */
15
-
16
- form#address {
17
- overflow: hidden;
18
- width: 100%;
19
- }
20
-
21
- form#address label {
22
- display: inline-block;
23
- margin-right: 12px;
24
- min-width: 100px;
25
- text-align: right;
26
- }
27
- form#address input { width: 200px; }
28
-
29
- form#address fieldset {
30
- width: 100%;
31
- min-width: 320px;
32
- }
33
- form#address fieldset#billing { display: none; }
34
-
35
- @media all and (min-width: 768px) {
36
- form#address fieldset {
37
- float: left;
38
- width: 50%;
39
- }
40
- }
41
-
42
- </style>
1
+ <h1>Checkout</h1>
2
+
3
+ <div id="checkout">
4
+
5
+ <% if @logged_in_user.id == 1 %>
6
+ <p class='note error'>You are logged in as the admin user. Please <a href='/logout'>logout</a> and complete your order as a different user.</p>
7
+ <% else %>
8
+ <section id="checkout-login">
9
+ <div class="wrapper" class='login-choices'>
10
+ <ul>
11
+ <li><p>Already a member? </p><button data-login-action="signin" id='signin_button' >Sign in</button></li>
12
+ <li><p>Continue as a new customer </p><button data-login-action="register" id='register_button' >New Customer</button></li>
13
+ </ul>
14
+ </div>
15
+
16
+ <section id='checkout-login-form'>
17
+ <div class="constrain" id='signin_form_container'>
18
+ <form action="/login" method="post" id='signin_form'>
19
+ <p><input name="username" type="text" placeholder="Email" /></p>
20
+ <p><input name="password" type="password" placeholder="Password" /></p>
21
+ <p><input type="submit" value="Continue" /></p>
22
+ </form>
23
+ </div>
24
+ <div class="constrain" id='register_form_container'>
25
+ <form action="/register" method="post" id='register_form'></p>
26
+ <p><input name="first_name" type="text" placeholder="First Name" /></p>
27
+ <p><input name="last_name" type="text" placeholder="Last Name" /></p>
28
+ <p><input name="email" type="text" placeholder="Email" /></p>
29
+ <p><input name="phone" type="text" placeholder="Phone" /></p>
30
+ <p><input name="pass1" type="password" placeholder="Password" /></p>
31
+ <p><input name="pass2" type="password" placeholder="Confirm Password" /></p>
32
+ <p><input name='newsletter' id='newsletter' type='checkbox' value='1' /> <label for='newsletter'>Send me updates on new products and special deals</label></p>
33
+ <p><input type="submit" value="Continue" /></p>
34
+ </form>
35
+ </div>
36
+ <div class="wrapper">
37
+ <div id='message'></div>
38
+ </div>
39
+ </section>
40
+ </section>
41
+ <% end %>
42
+
43
+ <section id="checkout-continue">
44
+ <a href="/">return to the store</a>
45
+ </section>
46
+ </div>
47
+
48
+ <%= content_for :caboose_js do %>
49
+ <%= javascript_include_tag 'caboose/checkout_login_register' %>
43
50
  <% end %>
51
+ <%= content_for :caboose_css do %>
52
+ <%= stylesheet_link_tag 'caboose/message_boxes' %>
53
+ <%= stylesheet_link_tag 'caboose/checkout' %>
54
+ <% end %>
@@ -1,79 +1,112 @@
1
- <% if Caboose::payment_processor == 'authorize.net' %>
2
- <form id="payment" target="relay" action="<%= Caboose::PaymentProcessor.form_url(@order) %>" method="post">
3
- <%= sim_fields(@sim_transaction) %>
4
- <label>Card Number</label>
5
- <input name="x_card_num" type="text" />
6
- <label>Expiration</label>
7
- <input id="expiration" name="x_exp_date" type="hidden" />
8
-
9
- <br />
10
-
11
- <select id="month" name="month">
12
- <option value="01">01 - Jan</option>
13
- <option value="02">02 - Feb</option>
14
- <option value="03">03 - Mar</option>
15
- <option value="04">04 - Apr</option>
16
- <option value="05">05 - May</option>
17
- <option value="06">06 - Jun</option>
18
- <option value="07">07 - Jul</option>
19
- <option value="08">08 - Aug</option>
20
- <option value="09">09 - Sep</option>
21
- <option value="10">10 - Oct</option>
22
- <option value="11">11 - Nov</option>
23
- <option value="12">12 - Dec</option>
24
- </select>
25
- /
26
- <select id="year" name="year">
27
- <% (DateTime.now.year...DateTime.now.year + 20).each do |i| %>
28
- <option value="<%= i-2000 %>"><%= i %></option>
29
- <% end %>
30
- </select>
31
-
32
- <br />
33
-
34
- <label>Security Code</label>
35
- <input id="x_card_code" name="x_card_code" type="text" />
36
- <input type="submit" value="Submit" />
37
- </form>
38
- <% end %>
1
+ <%
2
+ store_config = @site.store_config
3
+ %>
4
+ <div id="checkout">
5
+ <h2>Payment</h2>
6
+ <section id='checkout-payment'>
7
+ <% if store_config.pp_name == 'authorize.net' %>
8
+ <form id="payment" target="relay" action="https://secure.authorize.net/gateway/transact.dll" method="post">
9
+ <%= sim_fields(@sim_transaction) %>
10
+ <input id="x_invoice_num" name="x_invoice_num" type="hidden" value="<%= @order.id %>" />
11
+ <input id="x_description" name="x_after_relay" type="hidden" value="<%= raw "#{@request.protocol}#{@request.host_with_port}/checkout/authnet-response/#{@order.id}" %>" />
12
+ <p><input name="x_card_num" id='billing-cc-number' type="text" maxlength="16" placeholder="Card Number" /></p>
13
+ <p>
14
+ <input id="expiration" name="x_exp_date" type="hidden" />
15
+ <select id="month" name="month">
16
+ <option value="01">01 - Jan</option>
17
+ <option value="02">02 - Feb</option>
18
+ <option value="03">03 - Mar</option>
19
+ <option value="04">04 - Apr</option>
20
+ <option value="05">05 - May</option>
21
+ <option value="06">06 - Jun</option>
22
+ <option value="07">07 - Jul</option>
23
+ <option value="08">08 - Aug</option>
24
+ <option value="09">09 - Sep</option>
25
+ <option value="10">10 - Oct</option>
26
+ <option value="11">11 - Nov</option>
27
+ <option value="12">12 - Dec</option>
28
+ </select>
29
+ /
30
+ <select id="year" name="year">
31
+ <% (DateTime.now.year...DateTime.now.year + 20).each do |i| %>
32
+ <option value="<%= i-2000 %>"><%= i %></option>
33
+ <% end %>
34
+ </select>
35
+ </p>
36
+ </form>
37
+ <% end %>
38
+ </section>
39
+ <section id='checkout-confirm'>
40
+ <section id='shipping_address'>
41
+ <h3>Shipping Address</h3>
42
+ <% sa = @order.shipping_address %>
43
+ <address>
44
+ <%= "#{sa.first_name} #{sa.last_name}" %><br />
45
+ <%= sa.address1 %><br />
46
+ <%= "#{sa.address2}<br />" if sa.address2 and not sa.address2.empty? %>
47
+ <%= "#{sa.city}, #{sa.state} #{sa.zip}" %>
48
+ </address>
49
+ <p><a href="/checkout/addresses">Edit</a></p>
50
+ </section>
51
+ <section id='billing_address'>
52
+ <h3>Billing Address</h3>
53
+ <% ba = @order.billing_address %>
54
+ <address>
55
+ <%= "#{ba.first_name} #{ba.last_name}" %><br />
56
+ <%= ba.address1 %><br />
57
+ <%= "#{ba.address2}<br />" if ba.address2 and not ba.address2.empty? %>
58
+ <%= "#{ba.city}, #{ba.state} #{ba.zip}" %>
59
+ </address>
60
+ <p><a href="/checkout/addresses">Edit</a></p>
61
+ </section>
62
+ <section id='shipping_method'>
63
+ <h3>Shipping</h3>
64
+ <p><%= @order.shipping_carrier %> <%= @order.shipping_service_name %> - <%= number_to_currency(@order.shipping) %></p>
65
+ <p><a href="/checkout/shipping">Edit</a></p>
66
+ </section>
67
+ <section id='payment_method'>
68
+ <h3>Payment</h3>
69
+ <div id='confirm_card'>
70
+ <p id='confirm_card_number'></p>
71
+ <p><a href="#" id='edit_payment'>Edit</a></p>
72
+ </div>
73
+ </section>
74
+ <div style='clear: left;'>&nbsp;</div>
75
+ </section>
76
+ <section>
77
+ <div id='cart'></div>
78
+ </section>
79
+ <section id="checkout-continue">
80
+ <div id='message'><p align='center'>Your credit card will not be charged until you confirm your order.</p></div>
81
+ <button class="blue">Continue to Order Confirmation</button>
82
+ <em>or</em>
83
+ <a href="/">return to the store</a>
84
+ </section>
85
+ <iframe id="relay" name="relay" style='display: block; width: 800px; height: 400px; border: #000 1px solid;'></iframe>
86
+ </div>
87
+
88
+ <%= content_for :caboose_js do %>
89
+ <%= javascript_include_tag 'caboose/cart' %>
90
+ <%= javascript_include_tag 'caboose/checkout_payment' %>
91
+ <script type='text/javascript'>
92
+ var SHOW_RELAY = <%= @show_relay ? 'true' : 'false' %>;
39
93
 
40
- <% if Caboose::payment_processor == 'payscape' %>
41
- <form id="payment" action="<%= @form_url %>" method="post" target="relay">
42
- <input id="billing-amount" type="hidden" value="<%= @order.total %>" />
43
- <input id="expiration" name="billing-cc-exp" type="hidden" />
44
-
45
- <div>
46
- <label for="billing-cc-number">Card number:</label>
47
- <input id="billing-cc-number" name="billing-cc-number" type="text" maxlength="16" />
48
- </div>
49
-
50
- <div>
51
- <label for="billing-expiration-month">Expiration:</label>
52
- <select name="month">
53
- <option value="01">01 - Jan</option>
54
- <option value="02">02 - Feb</option>
55
- <option value="03">03 - Mar</option>
56
- <option value="04">04 - Apr</option>
57
- <option value="05">05 - May</option>
58
- <option value="06">06 - Jun</option>
59
- <option value="07">07 - Jul</option>
60
- <option value="08">08 - Aug</option>
61
- <option value="09">09 - Sep</option>
62
- <option value="10">10 - Oct</option>
63
- <option value="11">11 - Nov</option>
64
- <option value="12">12 - Dec</option>
65
- </select>
66
- /
67
- <select name="year">
68
- <% (DateTime.now.year...DateTime.now.year + 20).each do |i| %>
69
- <option value="<%= i-2000 %>"><%= i %></option>
70
- <% end %>
71
- </select>
72
- </div>
73
-
74
- <!--<input type="submit" value="Submit" />-->
75
- </form>
94
+ var cart = false;
95
+ $(document).ready(function() {
96
+ cart = new Cart({
97
+ allow_edit_line_items: false,
98
+ allow_edit_gift_cards: false
99
+ });
100
+ });
101
+
102
+ </script>
76
103
  <% end %>
104
+ <%= content_for :caboose_css do %>
105
+ <%= stylesheet_link_tag 'caboose/cart' %>
106
+ <%= stylesheet_link_tag 'caboose/checkout' %>
107
+ <style type='text/css'>
77
108
 
78
- <iframe id="relay" name="relay"></iframe>
109
+ #checkout h3 { font-size: 14pt; font-weight: bold; }
79
110
 
111
+ </style>
112
+ <% end %>