caboose-cms 0.5.56 → 0.5.57

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +8 -8
  2. data/app/assets/javascripts/caboose/cart.js +43 -47
  3. data/app/assets/javascripts/caboose/checkout_step3.js +5 -3
  4. data/app/assets/javascripts/caboose/checkout_step4.js +2 -1
  5. data/app/assets/javascripts/caboose/model/index_table.js +6 -6
  6. data/app/assets/javascripts/caboose/product.js +61 -61
  7. data/app/assets/stylesheets/caboose/product_images.css.scss +31 -0
  8. data/app/assets/stylesheets/caboose/product_options.css.scss +34 -0
  9. data/app/assets/templates/caboose/cart/add_to_cart.jst.ejs +1 -2
  10. data/app/assets/templates/caboose/product/images.jst.ejs +1 -2
  11. data/app/assets/templates/caboose/product/images_old.jst.ejs +7 -0
  12. data/app/assets/templates/caboose/product/options.jst.ejs +0 -10
  13. data/app/controllers/caboose/application_controller.rb +12 -12
  14. data/app/controllers/caboose/checkout_controller.rb +53 -11
  15. data/app/controllers/caboose/products_controller.rb +27 -281
  16. data/app/controllers/caboose/sites_controller.rb +8 -7
  17. data/app/controllers/caboose/variants_controller.rb +123 -41
  18. data/app/models/caboose/order.rb +20 -13
  19. data/app/models/caboose/order_package.rb +3 -0
  20. data/app/models/caboose/schema.rb +30 -22
  21. data/app/models/caboose/shipping_calculator.rb +14 -4
  22. data/app/models/caboose/store_config.rb +1 -0
  23. data/app/views/caboose/checkout/_confirm.html.erb +1 -1
  24. data/app/views/caboose/checkout/step_four.html.erb +8 -41
  25. data/app/views/caboose/checkout/step_one.html.erb +2 -0
  26. data/app/views/caboose/checkout/step_three.html.erb +45 -34
  27. data/app/views/caboose/checkout/step_two.html.erb +2 -1
  28. data/app/views/caboose/products/_admin_header.html.erb +1 -1
  29. data/app/views/caboose/products/admin_edit_images.html.erb +2 -2
  30. data/app/views/caboose/sites/admin_edit_store_config.html.erb +2 -0
  31. data/app/views/caboose/{products/admin_edit_variant_sort_order.html.erb → variants/admin_edit_sort_order.html.erb} +0 -0
  32. data/app/views/caboose/variants/admin_index.html.erb +101 -0
  33. data/config/routes.rb +184 -113
  34. data/lib/caboose/version.rb +1 -1
  35. metadata +7 -7
  36. data/app/views/caboose/products/admin_edit_variant_columns.html.erb +0 -75
  37. data/app/views/caboose/products/admin_edit_variants.html.erb +0 -92
  38. data/app/views/caboose/products/admin_edit_variants_old.html.erb +0 -171
  39. data/app/views/caboose/products/admin_edit_variants_single.html.erb +0 -68
@@ -1,5 +1,6 @@
1
1
  module Caboose
2
2
  class StoreConfig < ActiveRecord::Base
3
+ self.table_name = 'store_configs'
3
4
  belongs_to :site
4
5
  attr_accessible :id,
5
6
  :site_id,
@@ -50,7 +50,7 @@
50
50
  <p><a href="/checkout/step-two">Edit billing address</a></p>
51
51
  </section>
52
52
  <section id='shipping_method'>
53
- <p><%= @order.shipping_method %> - <%= number_to_currency(@order.shipping) %></p>
53
+ <p><%= @order.shipping_service_name %> - <%= number_to_currency(@order.shipping) %></p>
54
54
  <p><a href="/checkout/step-three">Edit shipping method</a></p>
55
55
  </section>
56
56
  <section id='payment_method'>
@@ -1,11 +1,13 @@
1
+ <%
2
+ store_config = @site.store_config
3
+ %>
1
4
  <div id="checkout">
2
- <h2>Checkout</h2>
3
- <%= raw checkout_nav(4) %>
5
+ <h2>Payment</h2>
4
6
  <%= render :partial => 'caboose/checkout/confirm' %>
5
7
  <section id="checkout-payment">
6
8
  <div class="wrapper">
7
- <% if Caboose::payment_processor == 'authorize.net' %>
8
- <form id="payment" target="relay" action="<%= Caboose::PaymentProcessor.form_url(@order) %>" method="post">
9
+ <% if store_config.pp_name == 'authorize.net' %>
10
+ <form id="payment" target="relay" action="https://test.authorize.net/gateway/transact.dll" method="post">
9
11
  <%= sim_fields(@sim_transaction) %>
10
12
 
11
13
  <label>Card Number</label>
@@ -40,42 +42,7 @@
40
42
  <br />
41
43
  <input type="submit" value="Submit" />
42
44
  </form>
43
- <% end %>
44
-
45
- <% if Caboose::payment_processor == 'payscape' %>
46
- <form id="payment" action="<%= @form_url %>" method="post" target="relay">
47
- <input id="billing-amount" type="hidden" value="<%= @order.total %>" />
48
- <input id="expiration" name="billing-cc-exp" type="hidden" />
49
- <div>
50
- <label for="billing-cc-number">Card number:</label>
51
- <input id="billing-cc-number" name="billing-cc-number" type="text" maxlength="16" />
52
- </div>
53
- <div>
54
- <label for="billing-expiration-month">Expiration:</label>
55
- <select name="month">
56
- <option value="01">01 - Jan</option>
57
- <option value="02">02 - Feb</option>
58
- <option value="03">03 - Mar</option>
59
- <option value="04">04 - Apr</option>
60
- <option value="05">05 - May</option>
61
- <option value="06">06 - Jun</option>
62
- <option value="07">07 - Jul</option>
63
- <option value="08">08 - Aug</option>
64
- <option value="09">09 - Sep</option>
65
- <option value="10">10 - Oct</option>
66
- <option value="11">11 - Nov</option>
67
- <option value="12">12 - Dec</option>
68
- </select>
69
- /
70
- <select name="year">
71
- <% (DateTime.now.year...DateTime.now.year + 20).each do |i| %>
72
- <option value="<%= i-2000 %>"><%= i %></option>
73
- <% end %>
74
- </select>
75
- </div>
76
-
77
- <!--<input type="submit" value="Submit" />-->
78
- </form>
45
+ <iframe id="relay" name="relay" style='display: block; width: 800px; height: 400px; border: #000 1px solid;'></iframe>
79
46
  <% end %>
80
47
  </div>
81
48
  </section>
@@ -85,7 +52,7 @@
85
52
  <em>or</em>
86
53
  <a href="/">return to the store</a>
87
54
  </section>
88
- <iframe id="relay" name="relay"></iframe>
55
+
89
56
  </div>
90
57
 
91
58
  <%= content_for :caboose_js do %>
@@ -1,3 +1,5 @@
1
+ <h1>Checkout</h1>
2
+
1
3
  <div id="checkout">
2
4
 
3
5
  <% if @logged_in_user.id == 1 %>
@@ -1,39 +1,47 @@
1
- <div id="checkout" class='constrain'>
2
- <section id="checkout-shipping">
3
- <div class="wrapper">
4
- <% if @rates.count > 1 %>
5
- <p>Your package must be shipped in multiple packages. Please select
6
- how you would like each package to be delivered.</p>
7
- <% end %>
8
- <table>
9
- <tr>
10
- <th>Package</th>
11
- <th>Shipping Options</th>
1
+
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
+ <% @rates[0][:rates].each do |rate| %>
11
+ <a href='#' class='shipping_rate btn' data-carrier="<%= rate[:carrier] %>" data-service-code="<%= rate[:service_code] %>" data-service-name="<%= rate[:service_name] %>">
12
+ <%= number_to_currency(rate[:total_price], :precision => 2) %><br /><%= rate[:service_name] %>
13
+ </a>
14
+ <% end %>
15
+ </p>
16
+ <% else %>
17
+ <p>Your order must be shipped in multiple packages. Please select how you would like each package to be delivered.</p>
18
+ <table>
19
+ <tr>
20
+ <th>Package</th>
21
+ <th>Shipping Options</th>
22
+ </tr>
23
+ <% @rates.each_with_index do |package_rates, i| %>
24
+ <% op = package_rates[:order_package] %>
25
+ <% sp = op.shipping_package %>
26
+ <tr>
27
+ <td valign='top'>
28
+ <ul><% op.line_items.each do |li| %><li><%= li.variant.product.title %> (<%= li.variant.title %>)<% end %></ul>
29
+ </td>
30
+ <td valign='top'>
31
+ <% package_rates[:rates].each do |rate| %>
32
+ <a href='#' class='shipping_rate btn' data-carrier="<%= rate[:carrier] %>" data-service-code="<%= rate[:service_code] %>" data-service-name="<%= rate[:service_name] %>">
33
+ <%= number_to_currency(rate[:total_price], :precision => 2) %><br /><%= rate[:service_name] %>
34
+ </a>
35
+ <% end %>
36
+ </td>
12
37
  </tr>
13
- <% @rates.each_with_index do |arr, i| %>
14
- <% op = arr[0] %>
15
- <% sp = op.shipping_package %>
16
- <tr>
17
- <td valign='top'>
18
- <ul><% op.line_items.each do |li| %><li><%= li.variant.product.title %> (<%= li.variant.title %>)<% end %></ul>
19
- </td>
20
- <td valign='top'>
21
- <% arr[1].each do |rate| %>
22
- <button class="blue" data-shipping-code="<%= rate[:service_code] %>" data-shipping-method="<%= rate[:service_name] %>">
23
- <%= number_to_currency(rate[:total_price], :precision => 2) %><br /><%= rate[:service_name] %>
24
- </button>
25
- <% end %>
26
- </td>
27
- </tr>
28
- <% end %>
29
- </table>
30
- </div>
31
- </section>
32
- <section id="checkout-continue">
33
- <div id='message'></div>
34
- <a href="/">return to the store</a>
35
- </section>
38
+ <% end %>
39
+ </table>
40
+ <% end %>
36
41
  </div>
42
+
43
+ <div id='message'></div>
44
+ <p><a href="/">return to the store</a></p>
37
45
 
38
46
  <%= content_for :caboose_js do %>
39
47
  <%= javascript_include_tag 'caboose/checkout_step3' %>
@@ -41,4 +49,7 @@
41
49
  <%= content_for :caboose_css do %>
42
50
  <%= stylesheet_link_tag 'caboose/message_boxes' %>
43
51
  <%= stylesheet_link_tag 'caboose/checkout' %>
52
+ <style type='text/css'>
53
+ a.shipping_rate { margin-bottom: 10px; margin-right: 10px; }
54
+ </style>
44
55
  <% end %>
@@ -2,7 +2,8 @@
2
2
  sa = @order.shipping_address
3
3
  ba = @order.billing_address
4
4
  %>
5
- <div id="checkout" class='constrain'>
5
+
6
+ <div id="checkout">
6
7
  <% if @logged_in_user.id == 1 %>
7
8
  <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>
8
9
  <% else %>
@@ -15,7 +15,7 @@ tabs = {
15
15
  "/admin/products/#{@product.id}/categories" => 'Categories'
16
16
  }
17
17
 
18
- tabs["/admin/products/#{@product.id}/options" ] = 'Options <span style="font-size: 65%">(size, color, style, etc.)</span>' if @product.options && @product.options.count > 0
18
+ tabs["/admin/products/#{@product.id}/options" ] = 'Options <span style="font-size: 65%">(size, color, style, etc.)</span>'
19
19
  tabs["/admin/products/#{@product.id}/variants/sort-order" ] = 'Sort Option Values' if @product.options && @product.options.count > 0
20
20
  tabs["/admin/products/#{@product.id}/variants" ] = 'Inventory & Variants'
21
21
  tabs["/admin/products/#{@product.id}/images" ] = 'Images'
@@ -70,7 +70,7 @@ function select_image(image_id, confirm)
70
70
  $('#variants').html("<p class='loading'>Getting attached product variants...</p>");
71
71
  $.ajax({
72
72
  url: '/admin/products/<%= p.id %>/variants/json',
73
- success: function(resp) { variants = resp; select_image(image_id); }
73
+ success: function(resp) { variants = resp.models; select_image(image_id); }
74
74
  });
75
75
  return;
76
76
  }
@@ -158,7 +158,7 @@ function attach_image_to_variant(image_id, variant_id, attach)
158
158
  image_variant_ids.splice(i, 1);
159
159
  }
160
160
  $.ajax({
161
- url: '/admin/variants/' + variant_id + '/' + (attach ? 'attach-to-image' : 'unattach-from-image'),
161
+ url: '/admin/products/<%= p.id %>/variants/' + variant_id + '/' + (attach ? 'attach-to-image' : 'unattach-from-image'),
162
162
  type: 'put',
163
163
  data: { product_image_id: image_id },
164
164
  success: function(resp) {}
@@ -1,6 +1,8 @@
1
1
  <%
2
2
  s = @site
3
3
  store_config = s.store_config
4
+ StoreConfig.create(:site_id => @site.id) if @site.store_config.nil?
5
+ store_config = s.store_config
4
6
  %>
5
7
  <%= render :partial => 'caboose/sites/admin_header' %>
6
8
 
@@ -0,0 +1,101 @@
1
+ <%
2
+ p = @product
3
+ v = @variant
4
+
5
+ error_message = nil
6
+ if @highlight_variant_id # Make sure we're not trying to highlight a deleted variant
7
+ v = Variant.where(:id => @highlight_variant_id).first
8
+ if v.nil?
9
+ error_message = "<p class='note error'>The variant you want to highlight is not in the database.</p>"
10
+ elsif v.status == 'Deleted'
11
+ error_message = "<p class='note error'>The variant you want to highlight has been deleted.</p>"
12
+ end
13
+ end
14
+
15
+ %>
16
+
17
+ <%= render :partial => 'caboose/products/admin_header' %>
18
+
19
+ <div id='variants'></div>
20
+ <div id='message'><%= error_message %></div>
21
+
22
+ <!--
23
+ <p><input type='button' value='New Variant' onclick="add_variant(<%= p.id %>);" /></p>
24
+ <form id="add-multiple" action="/admin/products/<%= @product.id %>/variants/add-multiple" method="post">
25
+ <p style="margin: 0 0 12px"><small>CSV format: Alternate ID, Quantity, Price<%= ', ' if @product.option1 || @product.option2 || @product.option3 %><%= [@product.option1, @product.option2, @product.option3].compact.join(', ') %></small></p>
26
+ <textarea id="variants_csv" name="variants_csv" rows="8" cols="12" style="min-width: 500px; min-height: 250px; margin: 0 0 16px; padding: 12px"></textarea><br />
27
+ <input type="submit" value="Submit" />
28
+ <p class="message" style="margin: 12px 0 0; color: red"></p>
29
+ </form>
30
+ -->
31
+
32
+ <%= render :partial => 'caboose/products/admin_footer' %>
33
+
34
+ <% content_for :caboose_css do %>
35
+ <style type='text/css'>
36
+ tr.highlight td { background: #ffff99 }
37
+ td.sort_handle { background: #ccc; width: 20px; }
38
+
39
+ ul {
40
+ list-style-type: square;
41
+ padding: 0 0 0 24px;
42
+ margin: 12px 0 24px;
43
+ }
44
+ </style>
45
+ <% end %>
46
+
47
+ <% content_for :caboose_js do %>
48
+ <script type='text/javascript'>
49
+
50
+ <%
51
+ fields = ['Alternate ID', 'Quantity In Stock', 'Price']
52
+ fields << p.option1 if p.option1
53
+ fields << p.option2 if p.option2
54
+ fields << p.option3 if p.option3
55
+ %>
56
+
57
+ $(document).ready(function() {
58
+ var that = this;
59
+ var table = new IndexTable({
60
+ form_authenticity_token: '<%= form_authenticity_token %>',
61
+ container: 'variants',
62
+ base_url: '/admin/products/<%= p.id %>/variants',
63
+ allow_bulk_edit: false,
64
+ allow_bulk_delete: true,
65
+ allow_duplicate: false,
66
+ allow_advanced_edit: true,
67
+ fields: [
68
+ <% if p.option1 %>{ show: true , name: 'option1' , nice_name: <%= raw Caboose.json(p.option1) %> , sort: 'option1' , type: 'text' , value: function(v) { return v.option1 }, width: 75, align: 'left' },<% end %>
69
+ <% if p.option2 %>{ show: true , name: 'option2' , nice_name: <%= raw Caboose.json(p.option2) %> , sort: 'option2' , type: 'text' , value: function(v) { return v.option2 }, width: 75, align: 'left' },<% end %>
70
+ <% if p.option3 %>{ show: true , name: 'option3' , nice_name: <%= raw Caboose.json(p.option3) %> , sort: 'option3' , type: 'text' , value: function(v) { return v.option3 }, width: 75, align: 'left' },<% end %>
71
+ { show: true , name: 'status' , nice_name: 'Status' , sort: 'status' , type: 'text' , value: function(v) { return v.status }, width: 75, align: 'left' },
72
+ { show: true , name: 'alternate_id' , nice_name: 'Alternate ID' , sort: 'alternate_id' , type: 'text' , value: function(v) { return v.alternate_id }, width: 75, align: 'left' },
73
+ { show: true , name: 'sku' , nice_name: 'SKU' , sort: 'sku' , type: 'text' , value: function(v) { return v.sku }, width: 75, align: 'left' },
74
+ { show: false , name: 'barcode' , nice_name: 'Barcode' , sort: 'barcode' , type: 'text' , value: function(v) { return v.barcode }, width: 75, align: 'left' },
75
+ { show: true , name: 'price' , nice_name: 'Price' , sort: 'price' , type: 'text' , value: function(v) { return v.price }, width: 75, align: 'right' },
76
+ { show: true , name: 'quantity_in_stock' , nice_name: 'Quantity' , sort: 'quantity_in_stock' , type: 'text' , value: function(v) { return v.quantity_in_stock }, width: 50, align: 'right' },
77
+ { show: false , name: 'weight' , nice_name: 'Weight (grams)' , sort: 'weight' , type: 'text' , value: function(v) { return v.weight }, width: 50, align: 'right' },
78
+ { show: false , name: 'length' , nice_name: 'Length (in)' , sort: 'length' , type: 'text' , value: function(v) { return v.length }, width: 50, align: 'right' },
79
+ { show: false , name: 'width' , nice_name: 'Width (in)' , sort: 'width' , type: 'text' , value: function(v) { return v.width }, width: 50, align: 'right' },
80
+ { show: false , name: 'height' , nice_name: 'Height (in)' , sort: 'height' , type: 'text' , value: function(v) { return v.height }, width: 50, align: 'right' },
81
+ { show: false , name: 'cylinder' , nice_name: 'Cylinder' , sort: 'cylinder' , type: 'checkbox' , value: function(v) { return v.cylinder }, width: 50, align: 'center' },
82
+ { show: false , name: 'requires_shipping' , nice_name: 'Requires shipping' , sort: 'requires_shipping' , type: 'checkbox' , value: function(v) { return v.requires_shipping }, width: 50, align: 'center' },
83
+ { show: false , name: 'taxable' , nice_name: 'Taxable' , sort: 'taxable' , type: 'checkbox' , value: function(v) { return v.taxable }, width: 50, align: 'center' },
84
+ { show: false , name: 'allow_backorder' , nice_name: 'Allow backorder' , sort: 'allow_backorder' , type: 'checkbox' , value: function(v) { return v.allow_backorder }, width: 50, align: 'center' }
85
+ ],
86
+ new_model_text: 'New Variant',
87
+ new_model_fields: [
88
+ { name: 'alternate_id' , nice_name: 'Alternate ID' , type: 'text', width: 400 },
89
+ { name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text', width: 400 },
90
+ { name: 'price' , nice_name: 'Price' , type: 'text', width: 400 },
91
+ <% if p.option1 %>{ name: 'option1', nice_name: <%= raw Caboose.json(p.option1) %>, type: 'text', width: 400 },<% end %>
92
+ <% if p.option2 %>{ name: 'option2', nice_name: <%= raw Caboose.json(p.option2) %>, type: 'text', width: 400 },<% end %>
93
+ <% if p.option3 %>{ name: 'option3', nice_name: <%= raw Caboose.json(p.option3) %>, type: 'text', width: 400 },<% end %>
94
+ ],
95
+ bulk_import_fields: <%= raw Caboose.json(fields) %>,
96
+ bulk_import_url: '/admin/products/<%= p.id %>/variants/bulk'
97
+ });
98
+ });
99
+
100
+ </script>
101
+ <% end %>
@@ -1,47 +1,56 @@
1
1
  Caboose::Engine.routes.draw do
2
2
 
3
- get "admin" => "admin#index"
4
- put "admin/station" => "station#index_admin"
5
- get "station" => "station#index"
6
- get "station/plugin-count" => "station#plugin_count"
7
-
8
- get "modal" => "modal#layout"
9
- get "modal/:url" => "modal#index", :constraints => {:url => /.*/}
10
-
11
- get "login/forgot-password" => "login#forgot_password_form"
12
- post "login/forgot-password" => "login#send_reset_email"
13
- get "login/reset-password/:reset_id" => "login#reset_password_form"
14
- post "login/reset-password" => "login#reset_password"
15
- get "login" => "login#index"
16
- post "login" => "login#login"
17
- get "logout" => "logout#index"
18
- get "register" => "register#index"
19
- post "register" => "register#register"
20
-
21
- get "my-account" => "users#my_account"
22
- put "my-account" => "users#update_my_account"
23
-
24
- post "admin/sites/:id/members" => "sites#admin_add_member"
25
- delete "admin/sites/:id/members/:user_id" => "sites#admin_remove_member"
26
-
27
- post "admin/sites/:site_id/domains" => "domains#admin_add"
28
- put "admin/sites/:site_id/domains/:id" => "domains#admin_update"
29
- delete "admin/sites/:site_id/domains/:id" => "domains#admin_delete"
30
-
3
+ #=============================================================================
4
+ # Front end
5
+ #=============================================================================
6
+
7
+ get "admin" => "admin#index"
8
+ put "admin/station" => "station#index_admin"
9
+ get "station" => "station#index"
10
+ get "station/plugin-count" => "station#plugin_count"
11
+ get "modal" => "modal#layout"
12
+ get "modal/:url" => "modal#index", :constraints => {:url => /.*/}
13
+ get "login/forgot-password" => "login#forgot_password_form"
14
+ post "login/forgot-password" => "login#send_reset_email"
15
+ get "login/reset-password/:reset_id" => "login#reset_password_form"
16
+ post "login/reset-password" => "login#reset_password"
17
+ get "login" => "login#index"
18
+ post "login" => "login#login"
19
+ get "logout" => "logout#index"
20
+ get "register" => "register#index"
21
+ post "register" => "register#register"
22
+ get "my-account" => "users#my_account"
23
+ put "my-account" => "users#update_my_account"
24
+
25
+ #=============================================================================
26
+ # Sites
27
+ #=============================================================================
28
+
31
29
  get "admin/sites/options" => "sites#options"
32
30
  get "admin/sites/payment-processor-options" => "sites#payment_processor_options"
33
- get "admin/sites/smtp-auth-options" => "sites#smtp_auth_options"
34
- get "admin/sites" => "sites#admin_index"
31
+ get "admin/sites/smtp-auth-options" => "sites#smtp_auth_options"
35
32
  get "admin/sites/new" => "sites#admin_new"
36
33
  get "admin/sites/:id/store" => "sites#admin_edit_store_config"
37
34
  get "admin/sites/:id/smtp" => "sites#admin_edit_smtp_config"
38
35
  get "admin/sites/:id/block-types" => "sites#admin_edit_block_types"
39
36
  get "admin/sites/:id/delete" => "sites#admin_delete_form"
40
37
  get "admin/sites/:id" => "sites#admin_edit"
41
- put "admin/sites/:id" => "sites#admin_update"
42
- post "admin/sites" => "sites#admin_add"
38
+ get "admin/sites" => "sites#admin_index"
39
+
40
+ post "admin/sites" => "sites#admin_add"
41
+ put "admin/sites/:id" => "sites#admin_update"
43
42
  delete "admin/sites/:id" => "sites#admin_delete"
44
-
43
+ post "admin/sites/:id/members" => "sites#admin_add_member"
44
+ delete "admin/sites/:id/members/:user_id" => "sites#admin_remove_member"
45
+
46
+ post "admin/sites/:site_id/domains" => "domains#admin_add"
47
+ put "admin/sites/:site_id/domains/:id" => "domains#admin_update"
48
+ delete "admin/sites/:site_id/domains/:id" => "domains#admin_delete"
49
+
50
+ #=============================================================================
51
+ # 301 Redirects
52
+ #=============================================================================
53
+
45
54
  get "admin/redirects" => "redirects#admin_index"
46
55
  get "admin/redirects/new" => "redirects#admin_new"
47
56
  get "admin/redirects/:id" => "redirects#admin_edit"
@@ -49,6 +58,10 @@ Caboose::Engine.routes.draw do
49
58
  post "admin/redirects" => "redirects#admin_add"
50
59
  delete "admin/redirects/:id" => "redirects#admin_delete"
51
60
 
61
+ #=============================================================================
62
+ # Users
63
+ #=============================================================================
64
+
52
65
  get "admin/users" => "users#index"
53
66
  get "admin/users/options" => "users#options"
54
67
  get "admin/users/new" => "users#new"
@@ -64,6 +77,10 @@ Caboose::Engine.routes.draw do
64
77
  post "admin/users/:id/roles/:role_id" => "users#add_to_role"
65
78
  delete "admin/users/:id/roles/:role_id" => "users#remove_from_role"
66
79
 
80
+ #=============================================================================
81
+ # Roles
82
+ #=============================================================================
83
+
67
84
  get "admin/roles" => "roles#index"
68
85
  get "admin/roles/options" => "roles#options"
69
86
  get "admin/roles/new" => "roles#new"
@@ -75,6 +92,22 @@ Caboose::Engine.routes.draw do
75
92
  post "admin/roles/:id/permissions/:permission_id" => "roles#add_permission"
76
93
  delete "admin/roles/:id/permissions/:permission_id" => "roles#remove_permission"
77
94
 
95
+ #=============================================================================
96
+ # Permissions
97
+ #=============================================================================
98
+
99
+ get "admin/permissions" => "permissions#index"
100
+ get "admin/permissions/options" => "permissions#options"
101
+ get "admin/permissions/new" => "permissions#new"
102
+ get "admin/permissions/:id" => "permissions#edit"
103
+ put "admin/permissions/:id" => "permissions#update"
104
+ post "admin/permissions" => "permissions#create"
105
+ delete "admin/permissions/:id" => "permissions#destroy"
106
+
107
+ #=============================================================================
108
+ # Images
109
+ #=============================================================================
110
+
78
111
  get "admin/images" => "images#admin_index"
79
112
  get "admin/images/s3" => "images#admin_sign_s3"
80
113
  get "admin/images/s3-result" => "images#admin_s3_result"
@@ -92,14 +125,10 @@ Caboose::Engine.routes.draw do
92
125
  put "admin/media-categories/:id" => "media_categories#admin_update"
93
126
  delete "admin/media-categories/:id" => "media_categories#admin_delete"
94
127
 
95
- get "admin/permissions" => "permissions#index"
96
- get "admin/permissions/options" => "permissions#options"
97
- get "admin/permissions/new" => "permissions#new"
98
- get "admin/permissions/:id" => "permissions#edit"
99
- put "admin/permissions/:id" => "permissions#update"
100
- post "admin/permissions" => "permissions#create"
101
- delete "admin/permissions/:id" => "permissions#destroy"
102
-
128
+ #=============================================================================
129
+ # Settings
130
+ #=============================================================================
131
+
103
132
  get "admin/settings" => "settings#index"
104
133
  get "admin/settings/options" => "settings#options"
105
134
  get "admin/settings/new" => "settings#new"
@@ -108,7 +137,10 @@ Caboose::Engine.routes.draw do
108
137
  post "admin/settings" => "settings#create"
109
138
  delete "admin/settings/:id" => "settings#destroy"
110
139
 
111
- #get "pages" => "pages#index"
140
+ #=============================================================================
141
+ # Pages
142
+ #=============================================================================
143
+
112
144
  get "pages/:id" => "pages#show"
113
145
  get "pages/:id/redirect" => "pages#redirect"
114
146
  get "admin/pages/sitemap-options" => "pages#admin_sitemap_options"
@@ -166,9 +198,9 @@ Caboose::Engine.routes.draw do
166
198
  post "admin/pages/:page_id/blocks/:id/image" => "blocks#admin_update_image"
167
199
  post "admin/pages/:page_id/blocks/:id/file" => "blocks#admin_update_file"
168
200
 
169
- #put "admin/blocks/:id" => "fields#admin_update"
170
- #post "admin/blocks/:id/image" => "fields#admin_update_image"
171
- #post "admin/blocks/:id/file" => "fields#admin_update_file"
201
+ #=============================================================================
202
+ # Block types
203
+ #=============================================================================
172
204
 
173
205
  get "admin/block-types/store/sources" => "block_type_sources#admin_index"
174
206
  get "admin/block-types/store/sources/new" => "block_type_sources#admin_new"
@@ -200,7 +232,11 @@ Caboose::Engine.routes.draw do
200
232
  post "admin/block-types" => "block_types#admin_create"
201
233
 
202
234
  get "admin/block-type-categories/tree-options" => "block_type_categories#admin_tree_options"
203
-
235
+
236
+ #=============================================================================
237
+ # Posts
238
+ #=============================================================================
239
+
204
240
  get "posts" => "posts#index"
205
241
  get "posts/:id" => "posts#detail"
206
242
  get "admin/posts/category-options" => "posts#admin_category_options"
@@ -218,6 +254,10 @@ Caboose::Engine.routes.draw do
218
254
  post "admin/posts" => "posts#admin_add"
219
255
  delete "admin/posts/:id" => "posts#admin_delete"
220
256
 
257
+ #=============================================================================
258
+ # Calendar
259
+ #=============================================================================
260
+
221
261
  get "admin/calendars" => "calendars#admin_index"
222
262
  get "admin/calendars/:id" => "calendars#admin_edit"
223
263
  put "admin/calendars/:id" => "calendars#admin_update"
@@ -236,6 +276,10 @@ Caboose::Engine.routes.draw do
236
276
  get "admin/event-groups/frequency-options" => "event_groups#admin_frequency_options"
237
277
  get "admin/event-groups/repeat-by-options" => "event_groups#admin_repeat_by_options"
238
278
 
279
+ #=============================================================================
280
+ # AB Testing
281
+ #=============================================================================
282
+
239
283
  get "admin/ab-variants" => "ab_variants#admin_index"
240
284
  get "admin/ab-variants/new" => "ab_variants#admin_new"
241
285
  get "admin/ab-variants/:id" => "ab_variants#admin_edit"
@@ -248,15 +292,27 @@ Caboose::Engine.routes.draw do
248
292
  post "admin/ab-variants/:variant_id/options" => "ab_options#admin_create"
249
293
  delete "admin/ab-options/:id" => "ab_options#admin_delete"
250
294
 
295
+ #=============================================================================
251
296
  # Cart
252
- get '/cart' => 'cart#index'
253
- get '/cart/items' => 'cart#list'
254
- get '/cart/item-count' => 'cart#item_count'
255
- post '/cart' => 'cart#add'
256
- put '/cart/:line_item_id' => 'cart#update'
257
- delete '/cart/:line_item_id' => 'cart#remove'
297
+ #=============================================================================
298
+
299
+ get '/cart' => 'cart#index'
300
+ get '/cart/items' => 'cart#list'
301
+ get '/cart/item-count' => 'cart#item_count'
302
+ post '/cart' => 'cart#add'
303
+ put '/cart/:line_item_id' => 'cart#update'
304
+ delete '/cart/:line_item_id' => 'cart#remove'
305
+
306
+ #=============================================================================
307
+ # Reviews
308
+ #=============================================================================
258
309
 
310
+ post "/reviews/add" => "reviews#add"
311
+
312
+ #=============================================================================
259
313
  # Checkout
314
+ #=============================================================================
315
+
260
316
  get '/checkout' => 'checkout#index'
261
317
  get '/checkout/step-one' => 'checkout#step_one'
262
318
  get '/checkout/step-two' => 'checkout#step_two'
@@ -272,39 +328,17 @@ Caboose::Engine.routes.draw do
272
328
  post '/checkout/relay/:order_id' => 'checkout#relay'
273
329
  get '/checkout/empty' => 'checkout#empty'
274
330
 
331
+ #=============================================================================
275
332
  # Products
276
- get '/products/:id/info' => 'products#info'
277
- get '/products/:id' => 'products#index', :constraints => { :id => /.*/ }
278
- get '/products' => 'products#index'
279
-
280
- post '/variants/find-by-options' => 'variants#find_by_options'
281
- get '/variants/:id/display-image' => 'variants#display_image'
282
-
283
- get '/admin/variants/group' => 'variants#admin_group'
284
-
285
- get '/admin/products/:id/variants/group' => 'products#admin_group_variants'
286
- post '/admin/products/:id/variants/add' => 'products#admin_add_variants'
287
- post '/admin/products/:id/variants/remove' => 'products#admin_remove_variants'
288
- post '/admin/products/:id/variants/add-multiple' => 'products#admin_add_multiple_variants'
289
-
290
- get '/admin/products/add-upcs' => 'products#admin_add_upcs'
291
-
292
- get '/admin/vendors/status-options' => 'vendors#status_options'
293
- get '/admin/vendors/new' => 'vendors#admin_new'
294
- get '/admin/vendors/:id' => 'vendors#admin_edit'
295
- get '/admin/vendors' => 'vendors#admin_index'
296
- put '/admin/vendors/:id' => 'vendors#admin_update'
297
- post '/admin/vendors' => 'vendors#admin_add'
298
- delete '/admin/vendors/:id' => 'vendors#admin_delete'
299
-
300
- # Orders
333
+ #=============================================================================
301
334
 
302
- get '/admin/orders/:id/void' => 'orders#admin_void'
303
- get '/admin/orders/:id/refund' => 'orders#admin_refund'
304
- post '/admin/orders/:id/resend-confirmation' => 'orders#admin_resend_confirmation'
305
-
306
- post "/reviews/add" => "reviews#add"
335
+ get '/products/:id/info' => 'products#info'
336
+ get '/products/:id' => 'products#index', :constraints => { :id => /.*/ }
337
+ get '/products' => 'products#index'
307
338
 
339
+ post '/variants/find-by-options' => 'variants#find_by_options'
340
+ get '/variants/:id/display-image' => 'variants#display_image'
341
+
308
342
  get "/admin/products" => "products#admin_index"
309
343
  get "/admin/products/json" => "products#admin_json"
310
344
  get '/admin/products/sort' => 'products#admin_sort'
@@ -317,21 +351,24 @@ Caboose::Engine.routes.draw do
317
351
  get "/admin/products/:id/categories" => "products#admin_edit_categories"
318
352
  post "/admin/products/:id/categories" => "products#admin_add_to_category"
319
353
  delete "/admin/products/:id/categories/:category_id" => "products#admin_remove_from_category"
320
-
354
+
321
355
  get "/admin/products/:product_id/variants" => "variants#admin_index"
322
356
  get "/admin/products/:product_id/variants/json" => "variants#admin_json"
323
- get "/admin/products/:product_id/variants/sort-order" => "products#admin_edit_variant_sort_order"
324
- put '/admin/products/:product_id/variants/option1-sort-order' => 'products#admin_update_option1_sort_order'
325
- put '/admin/products/:product_id/variants/option2-sort-order' => 'products#admin_update_option2_sort_order'
326
- put '/admin/products/:product_id/variants/option3-sort-order' => 'products#admin_update_option3_sort_order'
327
- get "/admin/products/:product_id/variants/:variant_id/edit" => "variants#admin_edit"
357
+ get "/admin/products/:product_id/variants/sort-order" => "variants#admin_edit_sort_order"
358
+ put '/admin/products/:product_id/variants/option1-sort-order' => 'variants#admin_update_option1_sort_order'
359
+ put '/admin/products/:product_id/variants/option2-sort-order' => 'variants#admin_update_option2_sort_order'
360
+ put '/admin/products/:product_id/variants/option3-sort-order' => 'variants#admin_update_option3_sort_order'
328
361
  put "/admin/products/:product_id/variants/:id/attach-to-image" => "variants#admin_attach_to_image"
329
362
  put "/admin/products/:product_id/variants/:id/unattach-from-image" => "variants#admin_unattach_from_image"
363
+ get "/admin/products/:product_id/variants/:id" => "variants#admin_edit"
330
364
  put "/admin/products/:product_id/variants/:id" => "variants#admin_update"
331
- get "/admin/products/:id/variants/new" => "variants#admin_new"
332
- post "/admin/products/:id/variants" => "variants#admin_add"
333
- delete "/admin/variants/:id" => "variants#admin_delete"
365
+ get "/admin/products/:product_id/variants/new" => "variants#admin_new"
366
+ post '/admin/products/:product_id/variants/bulk' => 'variants#admin_bulk_add'
367
+ post "/admin/products/:product_id/variants" => "variants#admin_add"
368
+ delete '/admin/products/:product_id/variants/bulk' => 'variants#admin_bulk_delete'
369
+ delete "/admin/products/:product_id/variants/:id" => "variants#admin_delete"
334
370
  get "/admin/variants/status-options" => "variants#admin_status_options"
371
+ get '/admin/variants/group' => 'variants#admin_group'
335
372
 
336
373
  get "/admin/products/:id/images" => "products#admin_edit_images"
337
374
  post "/admin/products/:id/images" => "products#admin_add_image"
@@ -346,30 +383,42 @@ Caboose::Engine.routes.draw do
346
383
  delete "/admin/products/:id" => "products#admin_delete"
347
384
  put "/admin/products/:id/update-vendor" => "products#admin_update_vendor"
348
385
 
349
- get "/admin/stackable-groups/options" => "stackable_groups#admin_options"
350
- get "/admin/stackable-groups/json" => "stackable_groups#admin_json"
351
- get "/admin/stackable-groups/:id/json" => "stackable_groups#admin_json_single"
352
- get "/admin/stackable-groups" => "stackable_groups#admin_index"
353
- put "/admin/stackable-groups/:id" => "stackable_groups#admin_update"
354
- post "/admin/stackable-groups" => "stackable_groups#admin_add"
355
- delete "/admin/stackable-groups/bulk" => "stackable_groups#admin_bulk_delete"
356
- delete "/admin/stackable-groups/:id" => "stackable_groups#admin_delete"
357
-
358
- get "/admin/categories" => "categories#admin_index"
359
- get "/admin/categories/new" => "categories#admin_new"
360
- get "/admin/categories/options" => "categories#admin_options"
361
- get '/admin/categories/status-options' => 'categories#admin_status_options'
362
- get "/admin/categories/:id" => "categories#admin_edit"
363
- put "/admin/categories/:id" => "categories#admin_update"
364
- post "/admin/categories/:id" => "categories#admin_update"
365
- post "/admin/categories" => "categories#admin_add"
366
- delete "/admin/categories/:id" => "categories#admin_delete"
367
-
368
386
  get "/admin/product-images/:id/variant-ids" => "product_images#admin_variant_ids"
369
387
  get "/admin/product-images/:id/variants" => "product_images#admin_variants"
370
388
  delete "/admin/product-images/:id" => "product_images#admin_delete"
371
389
  get "/variant-images/:id" => "product_images#variant_images"
372
390
 
391
+ #=============================================================================
392
+ # Stackable groups
393
+ #=============================================================================
394
+
395
+ get "/admin/stackable-groups/options" => "stackable_groups#admin_options"
396
+ get "/admin/stackable-groups/json" => "stackable_groups#admin_json"
397
+ get "/admin/stackable-groups/:id/json" => "stackable_groups#admin_json_single"
398
+ get "/admin/stackable-groups" => "stackable_groups#admin_index"
399
+ put "/admin/stackable-groups/:id" => "stackable_groups#admin_update"
400
+ post "/admin/stackable-groups" => "stackable_groups#admin_add"
401
+ delete "/admin/stackable-groups/bulk" => "stackable_groups#admin_bulk_delete"
402
+ delete "/admin/stackable-groups/:id" => "stackable_groups#admin_delete"
403
+
404
+ #=============================================================================
405
+ # Categories
406
+ #=============================================================================
407
+
408
+ get "/admin/categories" => "categories#admin_index"
409
+ get "/admin/categories/new" => "categories#admin_new"
410
+ get "/admin/categories/options" => "categories#admin_options"
411
+ get '/admin/categories/status-options' => 'categories#admin_status_options'
412
+ get "/admin/categories/:id" => "categories#admin_edit"
413
+ put "/admin/categories/:id" => "categories#admin_update"
414
+ post "/admin/categories/:id" => "categories#admin_update"
415
+ post "/admin/categories" => "categories#admin_add"
416
+ delete "/admin/categories/:id" => "categories#admin_delete"
417
+
418
+ #=============================================================================
419
+ # Orders
420
+ #=============================================================================
421
+
373
422
  get "/admin/orders" => "orders#admin_index"
374
423
  get "/admin/orders/test-info" => "orders#admin_mail_test_info"
375
424
  get "/admin/orders/test-gmail" => "orders#admin_mail_test_gmail"
@@ -384,15 +433,37 @@ Caboose::Engine.routes.draw do
384
433
  put "/admin/orders/:id" => "orders#admin_update"
385
434
  put "/admin/orders/:order_id/line-items/:id" => "orders#admin_update_line_item"
386
435
  delete "/admin/orders/:id" => "orders#admin_delete"
387
-
436
+
437
+ get '/admin/orders/:id/void' => 'orders#admin_void'
438
+ get '/admin/orders/:id/refund' => 'orders#admin_refund'
439
+ post '/admin/orders/:id/resend-confirmation' => 'orders#admin_resend_confirmation'
440
+
441
+ #=============================================================================
442
+ # Vendors
443
+ #=============================================================================
444
+
445
+ get '/admin/vendors/status-options' => 'vendors#status_options'
446
+ get '/admin/vendors/new' => 'vendors#admin_new'
447
+ get '/admin/vendors/:id' => 'vendors#admin_edit'
448
+ get '/admin/vendors' => 'vendors#admin_index'
449
+ put '/admin/vendors/:id' => 'vendors#admin_update'
450
+ post '/admin/vendors' => 'vendors#admin_add'
451
+ delete '/admin/vendors/:id' => 'vendors#admin_delete'
452
+
453
+ #=============================================================================
388
454
  # API
455
+ #=============================================================================
456
+
389
457
  get "/api/products" => "products#api_index"
390
458
  get "/api/products/:id" => "products#api_details"
391
- get "/api/products/:id/variants" => "products#api_variants"
392
-
459
+ get "/api/products/:id/variants" => "products#api_variants"
393
460
  get "caboose/block-types" => "block_types#api_block_type_list"
394
461
  get "caboose/block-types/:name" => "block_types#api_block_type"
395
462
 
463
+ #=============================================================================
464
+ # Catch all
465
+ #=============================================================================
466
+
396
467
  match '*path' => 'pages#show'
397
468
  root :to => 'pages#show'
398
469