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
@@ -1,15 +1,64 @@
1
- <h3>Checkout</h3>
2
- <%= render :partial => '/caboose/checkout/cart' %>
3
1
 
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_form' %>
9
-
10
- <% content_for :caboose_css do %>
11
- <style>
12
- form#shipping-rates label { display: inline; }
13
- form#shipping-rates input[type=submit] { margin-top: 12px; }
14
- </style>
2
+ <h1>Shipping Rates</h1>
3
+ <div id="checkout">
4
+ <%
5
+ Caboose.log(@rates.count)
6
+ %>
7
+ <% if @rates.count == 1 %>
8
+ <p>Please select which shipping method you'd like to use.</p>
9
+ <p>
10
+ <% op = @rates[0][:order_package] %>
11
+ <% @rates[0][:rates].each do |rate| %>
12
+ <% sm = rate[:shipping_method] %>
13
+ <a href='#' class='shipping_rate btn'
14
+ data-order_package_id="<%= op.id %>"
15
+ data-shipping_method_id="<%= sm.id %>"
16
+ data-total="<%= rate[:total_price] %>"
17
+ ><%= number_to_currency(rate[:total_price], :precision => 2) %><br /><%= sm.service_name %>
18
+ </a>
19
+ <% end %>
20
+ </p>
21
+ <% else %>
22
+ <p>Your order must be shipped in multiple packages. Please select how you would like each package to be delivered.</p>
23
+ <table>
24
+ <tr>
25
+ <th>Package</th>
26
+ <th>Shipping Options</th>
27
+ </tr>
28
+ <% @rates.each_with_index do |package_rates, i| %>
29
+ <% op = package_rates[:order_package] %>
30
+ <% sp = op.shipping_package %>
31
+ <tr>
32
+ <td valign='top'>
33
+ <ul><% op.line_items.each do |li| %><li><%= li.variant.product.title %> (<%= li.variant.title %>)<% end %></ul>
34
+ </td>
35
+ <td valign='top'>
36
+ <% package_rates[:rates].each do |rate| %>
37
+ <% sm = rate[:shipping_method] %>
38
+ <a href='#' class='shipping_rate btn'
39
+ data-order_package_id="<%= op.id %>"
40
+ data-shipping_method_id="<%= sm.id %>"
41
+ data-total="<%= rate[:total_price] %>"
42
+ ><%= number_to_currency(rate[:total_price], :precision => 2) %><br /><%= sm.service_name %>
43
+ </a>
44
+ <% end %>
45
+ </td>
46
+ </tr>
47
+ <% end %>
48
+ </table>
49
+ <% end %>
50
+ </div>
51
+
52
+ <div id='message'></div>
53
+ <p><a href="/">return to the store</a></p>
54
+
55
+ <%= content_for :caboose_js do %>
56
+ <%= javascript_include_tag 'caboose/checkout_shipping' %>
15
57
  <% end %>
58
+ <%= content_for :caboose_css do %>
59
+ <%= stylesheet_link_tag 'caboose/message_boxes' %>
60
+ <%= stylesheet_link_tag 'caboose/checkout' %>
61
+ <style type='text/css'>
62
+ a.shipping_rate { margin-bottom: 10px; margin-right: 10px; }
63
+ </style>
64
+ <% end %>
@@ -0,0 +1,89 @@
1
+ <%
2
+ gc = @gift_card
3
+ %>
4
+
5
+ <h1>Edit Gift Card</h1>
6
+
7
+ <p><div id='giftcard_<%= gc.id %>_name' ></div></p>
8
+ <p><div id='giftcard_<%= gc.id %>_code' ></div></p>
9
+ <p><div id='giftcard_<%= gc.id %>_card_type' ></div></p>
10
+ <p><div id='giftcard_<%= gc.id %>_total' ></div></p>
11
+ <p><div id='giftcard_<%= gc.id %>_balance' ></div></p>
12
+ <p><div id='giftcard_<%= gc.id %>_min_order_total' ></div></p>
13
+ <p><div id='giftcard_<%= gc.id %>_date_available' ></div></p>
14
+ <p><div id='giftcard_<%= gc.id %>_date_expires' ></div></p>
15
+ <p><div id='giftcard_<%= gc.id %>_status' ></div></p>
16
+ <div id='message'></div>
17
+
18
+ <h2>Usage</h2>
19
+ <% if gc.discounts && gc.discounts.count > 0 %>
20
+ <table class='data'>
21
+ <tr>
22
+ <th>Order #</th>
23
+ <th>Amount</th>
24
+ </tr>
25
+ <% gc.discounts.each do |d| %>
26
+ <tr>
27
+ <td><a href='/admin/orders/<%= d.order_id %>'><%= d.order_id %></a></td>
28
+ <td><%= number_to_currency(d.amount) %></td>
29
+ </tr>
30
+ <% end %>
31
+ </table>
32
+ <% else %>
33
+ <p>This gift card has not been used yet.</p>
34
+ <% end %>
35
+
36
+ <p>
37
+ <input type='button' value='< Back' onclick="window.location='/admin/gift-cards';" />
38
+ <input type='button' value='Delete Gift Card' onclick="delete_gift_card(<%= gc.id %>);" />
39
+ </p>
40
+
41
+ <% content_for :caboose_js do %>
42
+ <%= javascript_include_tag 'caboose/model/all' %>
43
+ <script type='text/javascript'>
44
+
45
+ $(document).ready(function() {
46
+ new ModelBinder({
47
+ name: 'GiftCard',
48
+ id: <%= gc.id %>,
49
+ update_url: '/admin/gift-cards/<%= gc.id %>',
50
+ authenticity_token: '<%= form_authenticity_token %>',
51
+ attributes: [
52
+ { name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(gc.name ) %>, width: 400, align: 'left' },
53
+ { name: 'code' , nice_name: 'Code' , type: 'text' , value: <%= raw Caboose.json(gc.code ) %>, width: 400, align: 'left' },
54
+ { name: 'card_type' , nice_name: 'Type' , type: 'select' , value: <%= raw Caboose.json(gc.card_type ) %>, width: 400, align: 'left' , options_url: '/admin/gift-cards/card-type-options' },
55
+ { name: 'total' , nice_name: 'Total' , type: 'text' , value: <%= raw Caboose.json(sprintf('%.2f', gc.total )) %>, width: 400, align: 'right' },
56
+ { name: 'balance' , nice_name: 'Balance' , type: 'text' , value: <%= raw Caboose.json(sprintf('%.2f', gc.balance )) %>, width: 400, align: 'right' },
57
+ { name: 'min_order_total' , nice_name: 'Minimum Order Total' , type: 'text' , value: <%= raw Caboose.json(sprintf('%.2f', gc.min_order_total )) %>, width: 400, align: 'right' },
58
+ { name: 'date_available' , nice_name: 'Date Available' , type: 'date' , value: <%= raw Caboose.json(gc.date_available ? gc.date_available.strftime('%m/%d/%Y') : '') %>, width: 400, align: 'left' },
59
+ { name: 'date_expires' , nice_name: 'Date Expires' , type: 'date' , value: <%= raw Caboose.json(gc.date_expires ? gc.date_expires.strftime('%m/%d/%Y') : '') %>, width: 400, align: 'left' },
60
+ { name: 'status' , nice_name: 'Status' , type: 'select' , value: <%= raw Caboose.json(gc.status ) %>, width: 400, align: 'left' , options_url: '/admin/gift-cards/status-options' }
61
+ ]
62
+ });
63
+ });
64
+
65
+ function delete_gift_card(gc_id, confirm)
66
+ {
67
+ if (!confirm)
68
+ {
69
+ var p = $('<p/>')
70
+ .addClass('note warning')
71
+ .append("Are you sure you want to delete the gift card? ")
72
+ .append($('<input/>').attr('type','button').val('Yes').click(function(e) { delete_gift_card(gc_id, true); })).append(' ')
73
+ .append($('<input/>').attr('type','button').val('No' ).click(function(e) { $('#message').empty(); }));
74
+ $('#message').empty().append(p);
75
+ return;
76
+ }
77
+ $('#message').html("<p class='loading'>Deleting gift card...</p>");
78
+ $.ajax({
79
+ url: '/admin/gift-cards/' + gc_id,
80
+ type: 'delete',
81
+ success: function(resp) {
82
+ if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
83
+ if (resp.redirect) window.location = resp.redirect;
84
+ }
85
+ });
86
+ }
87
+
88
+ </script>
89
+ <% end %>
@@ -0,0 +1,52 @@
1
+ <%
2
+ sc = @site.store_config
3
+ %>
4
+
5
+ <h1>Gift Cards</h1>
6
+ <div id='gift_cards'></div>
7
+
8
+ <% content_for :caboose_js do %>
9
+ <%= javascript_include_tag 'caboose/model/all' %>
10
+ <script type='text/javascript'>
11
+
12
+ $(document).ready(function() {
13
+ var that = this;
14
+ var table = new IndexTable({
15
+ form_authenticity_token: '<%= form_authenticity_token %>',
16
+ container: 'gift_cards',
17
+ base_url: '/admin/gift-cards',
18
+ allow_bulk_edit: true,
19
+ allow_bulk_delete: true,
20
+ allow_duplicate: false,
21
+ allow_advanced_edit: true,
22
+ fields: [
23
+ { show: true , bulk_edit: true , name: 'name' , nice_name: 'Name' , sort: 'name' , type: 'text' , value: function(gc) { return gc.name; }, width: 75, align: 'left' },
24
+ { show: true , bulk_edit: true , name: 'code' , nice_name: 'Code' , sort: 'code' , type: 'text' , value: function(gc) { return gc.code; }, width: 75, align: 'left' },
25
+ { show: true , bulk_edit: true , name: 'card_type' , nice_name: 'Type' , sort: 'card_type' , type: 'select' , value: function(gc) { return gc.card_type; }, width: 75, align: 'left' , options_url: '/admin/gift-cards/card-type-options' },
26
+ { show: true , bulk_edit: true , name: 'total' , nice_name: 'Total' , sort: 'total' , type: 'text' , value: function(gc) { return curr(gc.total); }, width: 75, align: 'right' },
27
+ { show: true , bulk_edit: true , name: 'balance' , nice_name: 'Balance' , sort: 'balance' , type: 'text' , value: function(gc) { return curr(gc.balance); }, width: 75, align: 'right' },
28
+ { show: true , bulk_edit: true , name: 'min_order_total' , nice_name: 'Minimum Order' , sort: 'min_order_total' , type: 'text' , value: function(gc) { return curr(gc.min_order_total); }, width: 75, align: 'right' },
29
+ { show: true , bulk_edit: true , name: 'date_available' , nice_name: 'Date Available' , sort: 'date_available' , type: 'date' , value: function(gc) { return format_date(gc.date_available); }, width: 75, align: 'left' },
30
+ { show: true , bulk_edit: true , name: 'date_expires' , nice_name: 'Date Expires' , sort: 'date_expires' , type: 'date' , value: function(gc) { return format_date(gc.date_expires); }, width: 75, align: 'left' },
31
+ { show: true , bulk_edit: true , name: 'status' , nice_name: 'Status' , sort: 'status' , type: 'select' , value: function(gc) { return gc.status; }, width: 75, align: 'left' , options_url: '/admin/gift-cards/status-options' }
32
+ ],
33
+ new_model_text: 'New Gift Card',
34
+ no_models_text: 'There are no gift cards right now.',
35
+ new_model_fields: [
36
+ { name: 'code', nice_name: 'Code', type: 'text', width: 400 }
37
+ ],
38
+ bulk_import_fields: ['code'],
39
+ bulk_import_url: '/admin/gift-cards/bulk'
40
+ });
41
+ });
42
+
43
+ function format_date(str)
44
+ {
45
+ if (!str)
46
+ return '';
47
+ var d = new Date(str);
48
+ return d.getMonth() + '/' + d.getDate() + '/' + d.getFullYear();
49
+ }
50
+
51
+ </script>
52
+ <% end %>
@@ -329,39 +329,41 @@ Caboose::Engine.routes.draw do
329
329
  delete "admin/ab-options/:id" => "ab_options#admin_delete"
330
330
 
331
331
  #=============================================================================
332
- # Cart
332
+ # Reviews
333
333
  #=============================================================================
334
334
 
335
- get '/cart' => 'cart#index'
336
- get '/cart/items' => 'cart#list'
337
- get '/cart/item-count' => 'cart#item_count'
338
- post '/cart' => 'cart#add'
339
- put '/cart/:line_item_id' => 'cart#update'
340
- delete '/cart/:line_item_id' => 'cart#remove'
335
+ post "/reviews/add" => "reviews#add"
341
336
 
342
337
  #=============================================================================
343
- # Reviews
338
+ # Cart
344
339
  #=============================================================================
345
340
 
346
- post "/reviews/add" => "reviews#add"
341
+ get '/cart' => 'cart#index'
342
+ get '/cart/items' => 'cart#list'
343
+ get '/cart/item-count' => 'cart#item_count'
344
+ post '/cart' => 'cart#add'
345
+ post '/cart/gift-cards' => 'cart#add_gift_card'
346
+ delete '/cart/discounts/:discount_id' => 'cart#remove_discount'
347
+ put '/cart/:line_item_id' => 'cart#update'
348
+ delete '/cart/:line_item_id' => 'cart#remove'
347
349
 
348
350
  #=============================================================================
349
351
  # Checkout
350
352
  #=============================================================================
351
353
 
352
354
  get '/checkout' => 'checkout#index'
353
- get '/checkout/step-one' => 'checkout#step_one'
354
- get '/checkout/step-two' => 'checkout#step_two'
355
- get '/checkout/step-three' => 'checkout#step_three'
356
- get '/checkout/step-four' => 'checkout#step_four'
355
+ post '/checkout/attach-user' => 'checkout#attach_user'
356
+ post '/checkout/attach-guest' => 'checkout#attach_guest'
357
+ get '/checkout/addresses' => 'checkout#addresses'
358
+ put '/checkout/addresses' => 'checkout#update_addresses'
359
+ get '/checkout/shipping' => 'checkout#shipping'
360
+ put '/checkout/shipping' => 'checkout#update_shipping'
361
+ get '/checkout/gift-cards' => 'checkout#gift_cards'
362
+ get '/checkout/payment' => 'checkout#payment'
357
363
  get '/checkout/thanks' => 'checkout#thanks'
358
364
  get '/checkout/test-email' => 'checkout#test_email'
359
-
360
- get '/checkout/authnet-profile-form' => 'checkout#authnet_profile_form'
361
- put '/checkout/address' => 'checkout#update_address'
362
- post '/checkout/attach-user' => 'checkout#attach_user'
363
- post '/checkout/attach-guest' => 'checkout#attach_guest'
364
- put '/checkout/shipping' => 'checkout#update_shipping'
365
+
366
+ get '/checkout/authnet-profile-form' => 'checkout#authnet_profile_form'
365
367
  get '/checkout/authnet-relay/:order_id' => 'checkout#authnet_relay'
366
368
  post '/checkout/authnet-relay/:order_id' => 'checkout#authnet_relay'
367
369
  get '/checkout/authnet-relay' => 'checkout#authnet_relay'
@@ -502,6 +504,24 @@ Caboose::Engine.routes.draw do
502
504
  get "admin/orders/:order_id/shipping-address/json" => "shipping_addresses#admin_json"
503
505
  put "admin/orders/:order_id/shipping-address" => "shipping_addresses#admin_update"
504
506
 
507
+ #=============================================================================
508
+ # Gift cards
509
+ #=============================================================================
510
+
511
+ get "/admin/gift-cards" => "gift_cards#admin_index"
512
+ get "/admin/gift-cards/json" => "gift_cards#admin_json"
513
+ get "/admin/gift-cards/new" => "gift_cards#admin_new"
514
+ get "/admin/gift-cards/status-options" => "gift_cards#admin_status_options"
515
+ get "/admin/gift-cards/card-type-options" => "gift_cards#admin_card_type_options"
516
+ get "/admin/gift-cards/:id/json" => "gift_cards#admin_json_single"
517
+ get "/admin/gift-cards/:id" => "gift_cards#admin_edit"
518
+ put "/admin/gift-cards/bulk" => "gift_cards#admin_bulk_update"
519
+ put "/admin/gift-cards/:id" => "gift_cards#admin_update"
520
+ post "/admin/gift-cards/bulk" => "gift_cards#admin_bulk_add"
521
+ post "/admin/gift-cards" => "gift_cards#admin_add"
522
+ delete "/admin/gift-cards/bulk" => "gift_cards#admin_bulk_delete"
523
+ delete "/admin/gift-cards/:id" => "gift_cards#admin_delete"
524
+
505
525
  #=============================================================================
506
526
  # Vendors
507
527
  #=============================================================================
@@ -116,6 +116,7 @@ module Caboose
116
116
  'caboose/model/bound_text.js',
117
117
  'caboose/model/bound_textarea.js',
118
118
  'caboose/model/class.js',
119
+ 'caboose/model/imageZoom.js',
119
120
  'caboose/model/index_table.js',
120
121
  'caboose/model/model_binder.js',
121
122
  'caboose/model/model.js',
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.69'
2
+ VERSION = '0.5.70'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.69
4
+ version: 0.5.70
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-12 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -382,19 +382,22 @@ files:
382
382
  - app/assets/javascripts/caboose/admin_block_edit.js
383
383
  - app/assets/javascripts/caboose/admin_edit_order.js
384
384
  - app/assets/javascripts/caboose/admin_images_index.js
385
+ - app/assets/javascripts/caboose/admin_main.js
385
386
  - app/assets/javascripts/caboose/admin_page_edit_content.js
386
387
  - app/assets/javascripts/caboose/admin_page_new_blocks.js
387
388
  - app/assets/javascripts/caboose/admin_products.js
388
389
  - app/assets/javascripts/caboose/application.js
389
390
  - app/assets/javascripts/caboose/authorize.net.js
390
391
  - app/assets/javascripts/caboose/cart.js
391
- - app/assets/javascripts/caboose/cart2.js
392
+ - app/assets/javascripts/caboose/cart_old.js
392
393
  - app/assets/javascripts/caboose/checkout.js
394
+ - app/assets/javascripts/caboose/checkout_addresses.js
395
+ - app/assets/javascripts/caboose/checkout_gift_cards.js
396
+ - app/assets/javascripts/caboose/checkout_login_register.js
393
397
  - app/assets/javascripts/caboose/checkout_module.js
394
- - app/assets/javascripts/caboose/checkout_step1.js
395
- - app/assets/javascripts/caboose/checkout_step2.js
396
- - app/assets/javascripts/caboose/checkout_step3.js
397
- - app/assets/javascripts/caboose/checkout_step4.js
398
+ - app/assets/javascripts/caboose/checkout_payment.js
399
+ - app/assets/javascripts/caboose/checkout_shipping.js
400
+ - app/assets/javascripts/caboose/imageZoom.js
398
401
  - app/assets/javascripts/caboose/jquery.detect.js
399
402
  - app/assets/javascripts/caboose/jquery.fileupload.js
400
403
  - app/assets/javascripts/caboose/jquery.iframe-transport.js
@@ -497,6 +500,7 @@ files:
497
500
  - app/controllers/caboose/domains_controller.rb
498
501
  - app/controllers/caboose/event_groups_controller.rb
499
502
  - app/controllers/caboose/events_controller.rb
503
+ - app/controllers/caboose/gift_cards_controller.rb
500
504
  - app/controllers/caboose/images_controller.rb
501
505
  - app/controllers/caboose/line_items_controller.rb
502
506
  - app/controllers/caboose/login_controller.rb
@@ -565,6 +569,7 @@ files:
565
569
  - app/models/caboose/database_session.rb
566
570
  - app/models/caboose/discount.rb
567
571
  - app/models/caboose/domain.rb
572
+ - app/models/caboose/gift_card.rb
568
573
  - app/models/caboose/line_item.rb
569
574
  - app/models/caboose/media_category.rb
570
575
  - app/models/caboose/media_file.rb
@@ -574,6 +579,7 @@ files:
574
579
  - app/models/caboose/order.rb
575
580
  - app/models/caboose/order_discount.rb
576
581
  - app/models/caboose/order_package.rb
582
+ - app/models/caboose/order_package_calculator.rb
577
583
  - app/models/caboose/order_pdf.rb
578
584
  - app/models/caboose/order_transaction.rb
579
585
  - app/models/caboose/page.rb
@@ -687,14 +693,18 @@ files:
687
693
  - app/views/caboose/categories/admin_edit.html.erb
688
694
  - app/views/caboose/categories/admin_index.html.erb
689
695
  - app/views/caboose/categories/admin_new.html.erb
696
+ - app/views/caboose/checkout/#Untitled-1#
690
697
  - app/views/caboose/checkout/_address_form.html.erb
691
698
  - app/views/caboose/checkout/_billing_form.html.erb
692
699
  - app/views/caboose/checkout/_cart.html.erb
700
+ - app/views/caboose/checkout/_cart_old.html.erb
693
701
  - app/views/caboose/checkout/_confirm.html.erb
702
+ - app/views/caboose/checkout/_confirm_table.html.erb
694
703
  - app/views/caboose/checkout/_order_discount.html.erb
695
704
  - app/views/caboose/checkout/_shipping_address.html.erb
696
705
  - app/views/caboose/checkout/_shipping_method.html.erb
697
706
  - app/views/caboose/checkout/_shipping_method_form.html.erb
707
+ - app/views/caboose/checkout/addresses.html.erb
698
708
  - app/views/caboose/checkout/authnet_profile_form.html.erb
699
709
  - app/views/caboose/checkout/authnet_relay.html.erb
700
710
  - app/views/caboose/checkout/authnet_response.html.erb
@@ -702,6 +712,7 @@ files:
702
712
  - app/views/caboose/checkout/discount.html.erb
703
713
  - app/views/caboose/checkout/empty.html.erb
704
714
  - app/views/caboose/checkout/error.html.erb
715
+ - app/views/caboose/checkout/gift_cards.html.erb
705
716
  - app/views/caboose/checkout/index.html.erb
706
717
  - app/views/caboose/checkout/login.html.erb
707
718
  - app/views/caboose/checkout/payment.html.erb
@@ -709,13 +720,6 @@ files:
709
720
  - app/views/caboose/checkout/relay_old.html.erb
710
721
  - app/views/caboose/checkout/relay_postMessage.html.erb
711
722
  - app/views/caboose/checkout/shipping.html.erb
712
- - app/views/caboose/checkout/step_four.html.erb
713
- - app/views/caboose/checkout/step_four_old.html.erb
714
- - app/views/caboose/checkout/step_one.html.erb
715
- - app/views/caboose/checkout/step_one_old.html.erb
716
- - app/views/caboose/checkout/step_three.html.erb
717
- - app/views/caboose/checkout/step_two.html.erb
718
- - app/views/caboose/checkout/step_two_old.html.erb
719
723
  - app/views/caboose/checkout/thanks.html.erb
720
724
  - app/views/caboose/events/admin_edit.html.erb
721
725
  - app/views/caboose/events/admin_index.html.erb
@@ -723,6 +727,8 @@ files:
723
727
  - app/views/caboose/extras/error.html.erb
724
728
  - app/views/caboose/extras/error404.html.erb
725
729
  - app/views/caboose/extras/error_invalid_site.html.erb
730
+ - app/views/caboose/gift_cards/admin_edit.html.erb
731
+ - app/views/caboose/gift_cards/admin_index.html.erb
726
732
  - app/views/caboose/images/admin_edit.html.erb
727
733
  - app/views/caboose/images/admin_index.html.erb
728
734
  - app/views/caboose/images/admin_new.html.erb
@@ -1,98 +0,0 @@
1
-
2
- Cart = function(params) { this.init(params); };
3
-
4
- Cart.prototype = {
5
-
6
- order: false,
7
-
8
- init: function(params)
9
- {
10
- for (var i in params)
11
- this[i] = params[i];
12
- this.refresh();
13
- },
14
-
15
- refresh: function()
16
- {
17
- var that = this;
18
- $('#message').html("<p class='loading'>Getting cart...</p>");
19
- $.ajax({
20
- url: '/cart/items',
21
- success: function(resp) {
22
- that.order = resp;
23
- that.print();
24
- }
25
- });
26
- },
27
-
28
- print: function()
29
- {
30
- var that = this;
31
- if (!this.order || !this.order.line_items || this.order.line_items.length == 0)
32
- {
33
- $('#cart').html("<p class='note'>You don't have any items in your shopping cart. <a href='/products'>Continue shopping.</a></p>");
34
- return;
35
- }
36
-
37
- var tbody = $('<tbody/>')
38
- .append($('<tr/>')
39
- .append($('<th/>').html('&nbsp'))
40
- .append($('<th/>').html('Item'))
41
- .append($('<th/>').html('Unit Price'))
42
- .append($('<th/>').html('Quantity'))
43
- .append($('<th/>').html('Subtotal'))
44
- );
45
-
46
- $.each(this.order.line_items, function(i, li) {
47
- var v = li.variant;
48
- var p = v.product;
49
- var img = v.images ? v.images[0] : (p.featured_image ? p.featured_image : false);
50
- img = img ? $('<img/>').attr('src', img.urls.tiny) : '&nbsp;';
51
-
52
- tbody.append($('<tr/>')
53
- .append($('<td/>').attr('valign', 'top').append(img))
54
- .append($('<td/>').attr('valign', 'top')
55
- .append(v.title).append('<br/>')
56
- .append($('<a/>').attr('href','#').html('Remove').click(function(e) { e.preventDefault(); that.remove_item(li.id); }))
57
- )
58
- .append($('<td/>').css('text-align', 'right').html('$' + parseFloat(v.price).toFixed(2)))
59
- .append($('<td/>').css('text-align', 'right').append($('<div/>').attr('id', 'lineitem_' + li.id + '_quantity')))
60
- .append($('<td/>').css('text-align', 'right').html('$' + (v.price * li.quantity).toFixed(2)))
61
- );
62
- });
63
- tbody.append($('<tr/>')
64
- .append($('<td/>').css('text-align', 'right').attr('colspan', 4).html('Subtotal'))
65
- .append($('<td/>').css('text-align', 'right').html('$' + parseFloat(that.order.subtotal).toFixed(2)))
66
- );
67
- $('#cart').empty()
68
- .append($('<table/>').append(tbody))
69
- .append($('<p/>').addClass('controls')
70
- .append($('<input/>').attr('type', 'button').val('Continue Shopping').click(function() { window.location = '/products'; }))
71
- .append(' ')
72
- .append($('<input/>').attr('type', 'button').val('Checkout').click(function() { window.location = '/checkout'; }))
73
- );
74
-
75
- $.each(this.order.line_items, function(i, li) {
76
- m = new ModelBinder({
77
- name: 'LineItem',
78
- id: li.id,
79
- update_url: '/cart/' + li.id,
80
- authenticity_token: that.form_authenticity_token,
81
- attributes: [
82
- { name: 'quantity', nice_name: 'Qty', type: 'text', value: li.quantity, width: 50, fixed_placeholder: false, after_update: function() { that.refresh(); } }
83
- ]
84
- });
85
- });
86
- },
87
-
88
- remove_item: function(li_id)
89
- {
90
- var that = this;
91
- $.ajax({
92
- url: '/cart/' + li_id,
93
- type: 'delete',
94
- success: function(resp) { that.refresh(); }
95
- });
96
- }
97
-
98
- };