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,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.56'
2
+ VERSION = '0.5.57'
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.56
4
+ version: 0.5.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-08 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -443,6 +443,8 @@ files:
443
443
  - app/assets/stylesheets/caboose/model_binder.css
444
444
  - app/assets/stylesheets/caboose/page_bar_generator.css
445
445
  - app/assets/stylesheets/caboose/print.css
446
+ - app/assets/stylesheets/caboose/product_images.css.scss
447
+ - app/assets/stylesheets/caboose/product_options.css.scss
446
448
  - app/assets/stylesheets/caboose/register.css
447
449
  - app/assets/stylesheets/caboose/responsive.css.scss
448
450
  - app/assets/stylesheets/caboose/spectrum.css
@@ -461,6 +463,7 @@ files:
461
463
  - app/assets/templates/caboose/checkout/shipping.jst.ejs
462
464
  - app/assets/templates/caboose/messages/error.jst.ejs
463
465
  - app/assets/templates/caboose/product/images.jst.ejs
466
+ - app/assets/templates/caboose/product/images_old.jst.ejs
464
467
  - app/assets/templates/caboose/product/options.jst.ejs
465
468
  - app/controllers/caboose/ab_options_controller.rb
466
469
  - app/controllers/caboose/ab_variants_controller.rb
@@ -754,11 +757,6 @@ files:
754
757
  - app/views/caboose/products/admin_edit_images.html.erb
755
758
  - app/views/caboose/products/admin_edit_options.html.erb
756
759
  - app/views/caboose/products/admin_edit_seo.html.erb
757
- - app/views/caboose/products/admin_edit_variant_columns.html.erb
758
- - app/views/caboose/products/admin_edit_variant_sort_order.html.erb
759
- - app/views/caboose/products/admin_edit_variants.html.erb
760
- - app/views/caboose/products/admin_edit_variants_old.html.erb
761
- - app/views/caboose/products/admin_edit_variants_single.html.erb
762
760
  - app/views/caboose/products/admin_group_variants.html.erb
763
761
  - app/views/caboose/products/admin_index.html.erb
764
762
  - app/views/caboose/products/admin_new.html.erb
@@ -796,7 +794,9 @@ files:
796
794
  - app/views/caboose/users/new.html.erb
797
795
  - app/views/caboose/users/update_pic.html.erb
798
796
  - app/views/caboose/variants/admin_edit.html.erb
797
+ - app/views/caboose/variants/admin_edit_sort_order.html.erb
799
798
  - app/views/caboose/variants/admin_group.html.erb
799
+ - app/views/caboose/variants/admin_index.html.erb
800
800
  - app/views/caboose/variants/admin_new.html.erb
801
801
  - app/views/caboose/vendors/admin_edit.html.erb
802
802
  - app/views/caboose/vendors/admin_index.html.erb
@@ -1,75 +0,0 @@
1
- <%
2
- p = @product
3
- %>
4
- <%= render :partial => 'caboose/products/admin_header' %>
5
-
6
- <p class='note'>Check which columns you want to show in the list of variants.</p>
7
- <table>
8
- <tr>
9
- <td valign='top'>
10
- <div id='variantcol_1_option1' ></div>
11
- <div id='variantcol_1_option2' ></div>
12
- <div id='variantcol_1_option3' ></div>
13
- </td><td valign='top'>
14
- <div id='variantcol_1_status' ></div>
15
- <div id='variantcol_1_sku' ></div>
16
- <div id='variantcol_1_barcode' ></div>
17
- <div id='variantcol_1_price' ></div>
18
- <div id='variantcol_1_quantity_in_stock' ></div>
19
- </td><td valign='top'>
20
- <div id='variantcol_1_weight' ></div>
21
- <div id='variantcol_1_length' ></div>
22
- <div id='variantcol_1_width' ></div>
23
- <div id='variantcol_1_height' ></div>
24
- <div id='variantcol_1_cylinder' ></div>
25
- </td><td valign='top'>
26
- <div id='variantcol_1_requires_shipping' ></div>
27
- <div id='variantcol_1_allow_backorder' ></div>
28
- <div id='variantcol_1_taxable' ></div>
29
- </td>
30
- </tr>
31
- </table>
32
- <div id='message'></div>
33
- <p><input type='button' value='< Back' onclick="window.location='/admin/products/<%= p.id %>/variants';" /></p>
34
-
35
- <%= render :partial => 'caboose/products/admin_footer' %>
36
- <% content_for :caboose_js do %>
37
- <script type='text/javascript'>
38
-
39
- $(document).ready(function() {
40
- <% p.variants.each do |v| %>
41
- new ModelBinder({
42
- name: 'VariantCol',
43
- id: 1,
44
- update_url: '/admin/products/<%= p.id %>/variant-cols',
45
- authenticity_token: '<%= form_authenticity_token %>',
46
- attributes: [
47
- <% if p.option1 %>{ name: 'option1' , nice_name: <%= raw Caboose.json(p.option1) %> , type: 'checkbox', align: 'right', value: <%= @cols['option1' ] == true ? true : false %>, width: 150 },<% end %>
48
- <% if p.option2 %>{ name: 'option2' , nice_name: <%= raw Caboose.json(p.option2) %> , type: 'checkbox', align: 'right', value: <%= @cols['option1' ] == true ? true : false %>, width: 150 },<% end %>
49
- <% if p.option3 %>{ name: 'option3' , nice_name: <%= raw Caboose.json(p.option3) %> , type: 'checkbox', align: 'right', value: <%= @cols['option1' ] == true ? true : false %>, width: 150 },<% end %>
50
- { name: 'status' , nice_name: 'Status' , type: 'checkbox', align: 'right', value: <%= @cols['status' ] == true ? true : false %>, width: 150 },
51
- { name: 'sku' , nice_name: 'SKU' , type: 'checkbox', align: 'right', value: <%= @cols['sku' ] == true ? true : false %>, width: 150 },
52
- { name: 'barcode' , nice_name: 'Barcode' , type: 'checkbox', align: 'right', value: <%= @cols['barcode' ] == true ? true : false %>, width: 150 },
53
- { name: 'price' , nice_name: 'Price' , type: 'checkbox', align: 'right', value: <%= @cols['price' ] == true ? true : false %>, width: 150 },
54
- { name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'checkbox', align: 'right', value: <%= @cols['quantity_in_stock'] == true ? true : false %>, width: 150 },
55
- { name: 'weight' , nice_name: 'Weight (grams)' , type: 'checkbox', align: 'right', value: <%= @cols['weight' ] == true ? true : false %>, width: 175 },
56
- { name: 'length' , nice_name: 'Length (in)' , type: 'checkbox', align: 'right', value: <%= @cols['length' ] == true ? true : false %>, width: 175 },
57
- { name: 'width' , nice_name: 'Width (in)' , type: 'checkbox', align: 'right', value: <%= @cols['width' ] == true ? true : false %>, width: 175 },
58
- { name: 'height' , nice_name: 'Height (in)' , type: 'checkbox', align: 'right', value: <%= @cols['height' ] == true ? true : false %>, width: 175 },
59
- { name: 'cylinder' , nice_name: 'Cylinder' , type: 'checkbox', align: 'right', value: <%= @cols['cylinder' ] == true ? true : false %>, width: 175 },
60
- { name: 'requires_shipping' , nice_name: 'Requires shipping' , type: 'checkbox', align: 'right', value: <%= @cols['requires_shipping'] == true ? true : false %>, width: 200 },
61
- { name: 'taxable' , nice_name: 'Taxable' , type: 'checkbox', align: 'right', value: <%= @cols['taxable' ] == true ? true : false %>, width: 200 },
62
- { name: 'allow_backorder' , nice_name: 'Allow backorder' , type: 'checkbox', align: 'right', value: <%= @cols['allow_backorder' ] == true ? true : false %>, width: 200 },
63
-
64
- ]
65
- });
66
- <% end %>
67
- });
68
-
69
- var modal = false;
70
- $(window).load(function() {
71
- modal = new CabooseModal(800);
72
- });
73
-
74
- </script>
75
- <% end %>
@@ -1,92 +0,0 @@
1
- <% content_for :caboose_css do %>
2
- <style>
3
- ul {
4
- list-style-type: square;
5
- padding: 0 0 0 24px;
6
- margin: 12px 0 24px;
7
- }
8
- </style>
9
- <% end %>
10
-
11
- <%
12
- p = @product
13
- v = @variant
14
- %>
15
-
16
- <%= render :partial => 'caboose/products/admin_header' %>
17
-
18
- <div id='variants'></div>
19
-
20
- <div id='message'><%
21
- # Make sure we're not trying to highlight a deleted variant
22
- if @highlight_variant_id
23
- v = Variant.where(:id => @highlight_variant_id).first
24
- if v.nil?
25
- %><p class='note error'>The variant you want to highlight is not in the database.</p><%
26
- elsif v.status == 'Deleted'
27
- %><p class='note error'>The variant you want to highlight has been deleted.</p><%
28
- end
29
- end
30
- %></div>
31
-
32
- <p><input type='button' value='New Variant' onclick="add_variant(<%= p.id %>);" /></p>
33
-
34
- <form id="add-multiple" action="/admin/products/<%= @product.id %>/variants/add-multiple" method="post">
35
- <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>
36
- <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 />
37
- <input type="submit" value="Submit" />
38
- <p class="message" style="margin: 12px 0 0; color: red"></p>
39
- </form>
40
-
41
- <%= render :partial => 'caboose/products/admin_footer' %>
42
-
43
- <% content_for :caboose_css do %>
44
- <style type='text/css'>
45
- tr.highlight td { background: #ffff99 }
46
- td.sort_handle { background: #ccc; width: 20px; }
47
- </style>
48
- <% end %>
49
-
50
- <% content_for :caboose_js do %>
51
- <script type='text/javascript'>
52
-
53
- $(document).ready(function() {
54
- var that = this;
55
- var table = new IndexTable({
56
- form_authenticity_token: '<%= form_authenticity_token %>',
57
- container: 'variants',
58
- base_url: '/admin/products/<%= p.id %>/variants',
59
- allow_bulk_edit: false,
60
- allow_bulk_delete: true,
61
- allow_duplicate: false,
62
- allow_advanced_edit: true,
63
- fields: [
64
- <% 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 %>
65
- <% 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 %>
66
- <% 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 %>
67
- { show: true , name: 'status' , nice_name: 'Status' , sort: 'status' , type: 'text' , value: function(v) { return v.status }, width: 75, align: 'left' },
68
- { 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' },
69
- { show: true , name: 'sku' , nice_name: 'SKU' , sort: 'sku' , type: 'text' , value: function(v) { return v.sku }, width: 75, align: 'left' },
70
- { show: true , name: 'barcode' , nice_name: 'Barcode' , sort: 'barcode' , type: 'text' , value: function(v) { return v.barcode }, width: 75, align: 'left' },
71
- { show: true , name: 'price' , nice_name: 'Price' , sort: 'price' , type: 'text' , value: function(v) { return v.price }, width: 75, align: 'right' },
72
- { 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' },
73
- { show: true , name: 'weight' , nice_name: 'Weight (grams)' , sort: 'weight' , type: 'text' , value: function(v) { return v.weight }, width: 50, align: 'right' },
74
- { show: true , name: 'length' , nice_name: 'Length (in)' , sort: 'length' , type: 'text' , value: function(v) { return v.length }, width: 50, align: 'right' },
75
- { show: true , name: 'width' , nice_name: 'Width (in)' , sort: 'width' , type: 'text' , value: function(v) { return v.width }, width: 50, align: 'right' },
76
- { show: true , name: 'height' , nice_name: 'Height (in)' , sort: 'height' , type: 'text' , value: function(v) { return v.height }, width: 50, align: 'right' },
77
- { show: true , name: 'cylinder' , nice_name: 'Cylinder' , sort: 'cylinder' , type: 'checkbox' , value: function(v) { return v.cylinder }, width: 50, align: 'center' },
78
- { show: true , name: 'requires_shipping' , nice_name: 'Requires shipping' , sort: 'requires_shipping' , type: 'checkbox' , value: function(v) { return v.requires_shipping }, width: 50, align: 'center' },
79
- { show: true , name: 'taxable' , nice_name: 'Taxable' , sort: 'taxable' , type: 'checkbox' , value: function(v) { return v.taxable }, width: 50, align: 'center' },
80
- { show: true , name: 'allow_backorder' , nice_name: 'Allow backorder' , sort: 'allow_backorder' , type: 'checkbox' , value: function(v) { return v.allow_backorder }, width: 50, align: 'center' }
81
- ],
82
- new_model_text: 'New Variant',
83
- new_model_fields: [
84
- <% if p.option1 %>{ name: 'name', nice_name: 'Name', type: 'text', width: 400 },<% end %>
85
- <% if p.option1 %>{ name: 'name', nice_name: 'Name', type: 'text', width: 400 },<% end %>
86
- <% if p.option1 %>{ name: 'name', nice_name: 'Name', type: 'text', width: 400 },<% end %>
87
- ],
88
- });
89
- });
90
-
91
- </script>
92
- <% end %>
@@ -1,171 +0,0 @@
1
- <% content_for :caboose_css do %>
2
- <style>
3
- ul {
4
- list-style-type: square;
5
- padding: 0 0 0 24px;
6
- margin: 12px 0 24px;
7
- }
8
- </style>
9
- <% end %>
10
-
11
- <%
12
- p = @product
13
- v = @variant
14
- %>
15
-
16
- <%= render :partial => 'caboose/products/admin_header' %>
17
-
18
- <p style='font-size: 75%;'><a href='/admin/products/<%= p.id %>/variant-cols'>Edit visible columns</a></p>
19
-
20
- <div id='message'><%
21
- # Make sure we're not trying to highlight a deleted variant
22
- if @highlight_variant_id
23
- v = Variant.where(:id => @highlight_variant_id).first
24
- if v.nil?
25
- %><p class='note error'>The variant you want to highlight is not in the database.</p><%
26
- elsif v.status == 'Deleted'
27
- %><p class='note error'>The variant you want to highlight has been deleted.</p><%
28
- end
29
- end
30
- %></div>
31
-
32
- <div id='variants_wrapper'>
33
- <table id='variants'>
34
- <tr>
35
- <th>&nbsp;</th>
36
- <% if @cols['option1' ] && p.option1 %><th valign='bottom'><%= p.option1 %></th><% end %>
37
- <% if @cols['option2' ] && p.option2 %><th valign='bottom'><%= p.option2 %></th><% end %>
38
- <% if @cols['option3' ] && p.option3 %><th valign='bottom'><%= p.option3 %></th><% end %>
39
- <% if @cols['status' ] == true %><th valign='bottom'>Status </th><% end %>
40
- <% if @cols['alternate_id' ] == true %><th valign='bottom'>Alternate ID </th><% end %>
41
- <% if @cols['barcode' ] == true %><th valign='bottom'>Barcode </th><% end %>
42
- <% if @cols['price' ] == true %><th valign='bottom'>Price </th><% end %>
43
- <% if @cols['quantity_in_stock' ] == true %><th valign='bottom'>Quantity </th><% end %>
44
- <% if @cols['weight' ] == true %><th valign='bottom'>Weight </th><% end %>
45
- <% if @cols['length' ] == true %><th valign='bottom'>Length </th><% end %>
46
- <% if @cols['width' ] == true %><th valign='bottom'>Width </th><% end %>
47
- <% if @cols['height' ] == true %><th valign='bottom'>Height </th><% end %>
48
- <% if @cols['cylinder' ] == true %><th valign='bottom'>Cylinder </th><% end %>
49
- <% if @cols['requires_shipping' ] == true %><th valign='bottom'>Requires Shipping </th><% end %>
50
- <% if @cols['allow_backorder' ] == true %><th valign='bottom'>Allow Backorder </th><% end %>
51
- <% if @cols['taxable' ] == true %><th valign='bottom'>Taxable </th><% end %>
52
- <th>&nbsp;</th>
53
- <th>&nbsp;</th>
54
- </tr>
55
- <tbody id='variants_tbody'>
56
- <% p.variants.where(:status => ['Active', 'Inactive']).each do |v| %>
57
- <tr id='variant_<%= v.id %>' <% if @highlight_variant_id && v.id == @highlight_variant_id %>class='highlight'<% end %>>
58
- <td class='sort_handle'>&nbsp;</td>
59
- <% if @cols['option1' ] && p.option1 %><td><div id='variant_<%= v.id %>_option1' ></div></td><% end %>
60
- <% if @cols['option2' ] && p.option2 %><td><div id='variant_<%= v.id %>_option2' ></div></td><% end %>
61
- <% if @cols['option3' ] && p.option3 %><td><div id='variant_<%= v.id %>_option3' ></div></td><% end %>
62
- <% if @cols['status' ] == true %><td><div id='variant_<%= v.id %>_status' ></div></td><% end %>
63
- <% if @cols['alternate_id' ] == true %><td><div id='variant_<%= v.id %>_alternate_id' ></div></td><% end %>
64
- <% if @cols['barcode' ] == true %><td><div id='variant_<%= v.id %>_barcode' ></div></td><% end %>
65
- <% if @cols['price' ] == true %><td><div id='variant_<%= v.id %>_price' ></div></td><% end %>
66
- <% if @cols['quantity_in_stock' ] == true %><td><div id='variant_<%= v.id %>_quantity_in_stock' ></div></td><% end %>
67
- <% if @cols['weight' ] == true %><td><div id='variant_<%= v.id %>_weight' ></div></td><% end %>
68
- <% if @cols['length' ] == true %><td><div id='variant_<%= v.id %>_length' ></div></td><% end %>
69
- <% if @cols['width' ] == true %><td><div id='variant_<%= v.id %>_width' ></div></td><% end %>
70
- <% if @cols['height' ] == true %><td><div id='variant_<%= v.id %>_height' ></div></td><% end %>
71
- <% if @cols['cylinder' ] == true %><td><div id='variant_<%= v.id %>_cylinder' ></div></td><% end %>
72
- <% if @cols['requires_shipping' ] == true %><td><div id='variant_<%= v.id %>_requires_shipping' ></div></td><% end %>
73
- <% if @cols['allow_backorder' ] == true %><td><div id='variant_<%= v.id %>_allow_backorder' ></div></td><% end %>
74
- <% if @cols['taxable' ] == true %><td><div id='variant_<%= v.id %>_taxable' ></div></td><% end %>
75
- <td class='edit'><a href='/admin/products/<%= p.id %>/variants/<%= v.id %>/edit'>Edit</a></td>
76
- <td class='delete'><a href='#' onclick='delete_variant(<%= v.id %>);'>Delete</a></td>
77
- </tr>
78
- <% end %>
79
- </tbody>
80
- </table>
81
- </div>
82
-
83
- <p><input type='button' value='New Variant' onclick="add_variant(<%= p.id %>);" /></p>
84
-
85
- <form id="add-multiple" action="/admin/products/<%= @product.id %>/variants/add-multiple" method="post">
86
- <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>
87
- <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 />
88
- <input type="submit" value="Submit" />
89
- <p class="message" style="margin: 12px 0 0; color: red"></p>
90
- </form>
91
-
92
- <%= render :partial => 'caboose/products/admin_footer' %>
93
-
94
- <% content_for :caboose_css do %>
95
- <style type='text/css'>
96
- tr.highlight td { background: #ffff99 }
97
- td.sort_handle { background: #ccc; width: 20px; }
98
- </style>
99
- <% end %>
100
-
101
- <% content_for :caboose_js do %>
102
- <script type='text/javascript'>
103
-
104
- $(document).ready(function() {
105
- $('form#add-multiple').on('submit', function(event) {
106
- event.preventDefault();
107
- var $form = $(event.target);
108
-
109
- $.ajax({
110
- type: $form.attr('method'),
111
- url: $form.attr('action'),
112
- data: $form.serialize(),
113
- success: function(response) {
114
- console.log(response);
115
- if (response.success) {
116
- location.reload();
117
- } else {
118
- $form.find('.message').empty().text(response.error);
119
- }
120
- }
121
- });
122
- });
123
-
124
- <% p.variants.each do |v| %>
125
- new ModelBinder({
126
- name: 'Variant',
127
- id: <%= v.id %>,
128
- update_url: '/admin/variants/<%= v.id %>',
129
- authenticity_token: '<%= form_authenticity_token %>',
130
- attributes: [
131
- <% if @cols['option1' ] && p.option1 %>{ name: 'option1' , nice_name: <%= raw Caboose.json(p.option1) %> , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.option1 ) %>, width: 75, fixed_placeholder: false },<% end %>
132
- <% if @cols['option2' ] && p.option2 %>{ name: 'option2' , nice_name: <%= raw Caboose.json(p.option2) %> , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.option2 ) %>, width: 75, fixed_placeholder: false },<% end %>
133
- <% if @cols['option3' ] && p.option3 %>{ name: 'option3' , nice_name: <%= raw Caboose.json(p.option3) %> , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.option3 ) %>, width: 75, fixed_placeholder: false },<% end %>
134
- <% if @cols['status' ] == true %>{ name: 'status' , nice_name: 'Status' , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.status ) %>, width: 75, fixed_placeholder: false },<% end %>
135
- <% if @cols['alternate_id' ] == true %>{ name: 'alternate_id' , nice_name: 'Alternate ID' , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.alternate_id ) %>, width: 75, fixed_placeholder: false },<% end %>
136
- <% if @cols['sku' ] == true %>{ name: 'sku' , nice_name: 'SKU' , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.sku ) %>, width: 75, fixed_placeholder: false },<% end %>
137
- <% if @cols['barcode' ] == true %>{ name: 'barcode' , nice_name: 'Barcode' , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.barcode ) %>, width: 75, fixed_placeholder: false },<% end %>
138
- <% if @cols['price' ] == true %>{ name: 'price' , nice_name: 'Price' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.price ) %>, width: 75, fixed_placeholder: false },<% end %>
139
- <% if @cols['quantity_in_stock' ] == true %>{ name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.quantity_in_stock ) %>, width: 50, fixed_placeholder: false },<% end %>
140
- <% if @cols['weight' ] == true %>{ name: 'weight' , nice_name: 'Weight (grams)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.weight ) %>, width: 50, fixed_placeholder: false },<% end %>
141
- <% if @cols['length' ] == true %>{ name: 'length' , nice_name: 'Length (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.length ) %>, width: 50, fixed_placeholder: false },<% end %>
142
- <% if @cols['width' ] == true %>{ name: 'width' , nice_name: 'Width (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.width ) %>, width: 50, fixed_placeholder: false },<% end %>
143
- <% if @cols['height' ] == true %>{ name: 'height' , nice_name: 'Height (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.height ) %>, width: 50, fixed_placeholder: false },<% end %>
144
- <% if @cols['cylinder' ] == true %>{ name: 'cylinder' , nice_name: 'Cylinder' , type: 'checkbox' , align: 'center', value: <%= raw Caboose.json(v.cylinder ) %>, width: 50, fixed_placeholder: false },<% end %>
145
- <% if @cols['requires_shipping' ] == true %>{ name: 'requires_shipping' , nice_name: 'Requires shipping' , type: 'checkbox' , align: 'center', value: <%= raw Caboose.json(v.requires_shipping ) %>, width: 50, fixed_placeholder: false },<% end %>
146
- <% if @cols['taxable' ] == true %>{ name: 'taxable' , nice_name: 'Taxable' , type: 'checkbox' , align: 'center', value: <%= raw Caboose.json(v.taxable ) %>, width: 50, fixed_placeholder: false },<% end %>
147
- <% if @cols['allow_backorder' ] == true %>{ name: 'allow_backorder' , nice_name: 'Allow backorder' , type: 'checkbox' , align: 'center', value: <%= raw Caboose.json(v.allow_backorder ) %>, width: 50, fixed_placeholder: false } <% end %>
148
- ]
149
- });
150
- <% end %>
151
-
152
- $('#variants_tbody').sortable({
153
- handle: '.sort_handle',
154
- update: function(event, ui) {
155
- $.ajax({
156
- url: '/admin/products/<%= p.id %>/variants/sort-order',
157
- type: 'put',
158
- data: $('#variants_tbody').sortable('serialize', { key: 'variant_ids[]' }),
159
- success: function(resp) {}
160
- });
161
- }
162
- });
163
- });
164
-
165
- var modal = false;
166
- $(window).load(function() {
167
- modal = new CabooseModal('100%');
168
- });
169
-
170
- </script>
171
- <% end %>
@@ -1,68 +0,0 @@
1
- <%
2
- p = @product
3
- v = @variant
4
- %>
5
- <%= render :partial => 'caboose/products/admin_header' %>
6
-
7
- <p style='font-size: 75%;'><a href='/admin/products/<%= p.id %>/options'>Need options like color or size?</a></p>
8
-
9
- <table>
10
- <tr>
11
- <td valign='top'>
12
- <div id='variant_<%= v.id %>_alternate_id' ></div>
13
- <div id='variant_<%= v.id %>_sku' ></div>
14
- <div id='variant_<%= v.id %>_barcode' ></div>
15
- <div id='variant_<%= v.id %>_price' ></div>
16
- <div id='variant_<%= v.id %>_quantity_in_stock' ></div>
17
- <div id='variant_<%= v.id %>_allow_backorder' ></div>
18
- <div id='variant_<%= v.id %>_taxable' ></div>
19
- </td><td valign='top'>
20
- <div id='variant_<%= v.id %>_status' ></div>
21
- <div id='variant_<%= v.id %>_requires_shipping' ></div>
22
- <div id='variant_<%= v.id %>_weight' ></div>
23
- <div id='variant_<%= v.id %>_cylinder' ></div>
24
- <div id='variant_<%= v.id %>_length' ></div>
25
- <div id='variant_<%= v.id %>_width' ></div>
26
- <div id='variant_<%= v.id %>_height' ></div>
27
- </td>
28
- </tr>
29
- </table>
30
- <div id='message'></div>
31
-
32
- <%= render :partial => 'caboose/products/admin_footer' %>
33
-
34
- <% content_for :caboose_js do %>
35
- <script type='text/javascript'>
36
-
37
- $(document).ready(function() {
38
- m = new ModelBinder({
39
- name: 'Variant',
40
- id: <%= v.id %>,
41
- update_url: '/admin/variants/<%= v.id %>',
42
- authenticity_token: '<%= form_authenticity_token %>',
43
- attributes: [
44
- { name: 'status' , nice_name: 'Status' , type: 'select' , align: 'right' , value: <%= raw Caboose.json(v.status ) %>, text: <%= raw Caboose.json(v.status) %>, width: 250, options_url: '/admin/variants/status-options' },
45
- { name: 'alternate_id' , nice_name: 'Alternate ID' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.alternate_id ) %>, width: 250 },
46
- { name: 'sku' , nice_name: 'SKU' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.sku ) %>, width: 250 },
47
- { name: 'barcode' , nice_name: 'Barcode' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.barcode ) %>, width: 250 },
48
- { name: 'price' , nice_name: 'Price' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(sprintf("%.2f", v.price || 0 ) ) %>, width: 250 },
49
- { name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.quantity_in_stock ) %>, width: 250 },
50
- { name: 'weight' , nice_name: 'Weight (grams)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.weight ) %>, width: 250 },
51
- { name: 'length' , nice_name: 'Length (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.length ) %>, width: 250 },
52
- { name: 'width' , nice_name: 'Width (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.width ) %>, width: 250 },
53
- { name: 'height' , nice_name: 'Height (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.height ) %>, width: 250 },
54
- { name: 'cylinder' , nice_name: 'Cylinder' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.cylinder ) %>, width: 250 },
55
- { name: 'requires_shipping' , nice_name: 'Requires shipping' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.requires_shipping ) %>, width: 250 },
56
- { name: 'taxable' , nice_name: 'Taxable' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.taxable ) %>, width: 250 },
57
- { name: 'allow_backorder' , nice_name: 'Allow backorder' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.allow_backorder ) %>, width: 250 }
58
- ]
59
- });
60
- });
61
-
62
- var modal = false;
63
- $(window).load(function() {
64
- modal = new CabooseModal(800);
65
- });
66
-
67
- </script>
68
- <% end %>