caboose-cms 0.8.24 → 0.8.25

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,6 +27,10 @@ date_available = p.date_available ? p.date_available.strftime('%F') : ''
27
27
  %>
28
28
  $(document).ready(function() {
29
29
 
30
+ add_to_crumbtrail('/admin', 'Admin');
31
+ add_to_crumbtrail('/admin/products', 'Products');
32
+ add_to_crumbtrail('/admin/products/<%= p.id %>', <%= raw Caboose.json(p.title) %>);
33
+
30
34
  m = new ModelBinder({
31
35
  name: 'Product',
32
36
  id: <%= p.id %>,
@@ -55,6 +55,12 @@ p = @product
55
55
 
56
56
  var controller = false;
57
57
  $(document).ready(function() {
58
+
59
+ add_to_crumbtrail('/admin', 'Admin');
60
+ add_to_crumbtrail('/admin/products', 'Products');
61
+ add_to_crumbtrail('/admin/products/<%= p.id %>', <%= raw Caboose.json(p.title) %>);
62
+ add_to_crumbtrail('/admin/products/<%= p.id %>/images', 'Images');
63
+
58
64
  controller = new MediaController({
59
65
  top_cat_id: <%= raw Caboose.json(@media_category ? @top_media_category.id : false) %>,
60
66
  cat_id: <%= raw Caboose.json(@media_category ? @media_category.id : false) %>,
@@ -40,7 +40,13 @@ may_delete3 = p.variants.collect{|v| v.option3 }.uniq.count == 1
40
40
  <script type='text/javascript'>
41
41
 
42
42
  var mods_controller = false;
43
- $(document).ready(function() {
43
+ $(document).ready(function() {
44
+
45
+ add_to_crumbtrail('/admin', 'Admin');
46
+ add_to_crumbtrail('/admin/products', 'Products');
47
+ add_to_crumbtrail('/admin/products/<%= p.id %>', <%= raw Caboose.json(p.title) %>);
48
+ add_to_crumbtrail('/admin/products/<%= p.id %>/options', 'Options');
49
+
44
50
  m = new ModelBinder({
45
51
  name: 'Product',
46
52
  id: <%= p.id %>,
@@ -1,3 +1,4 @@
1
+ <div id='crumbtrail'></div>
1
2
  <h1>Products</h1>
2
3
 
3
4
  <p style="margin: 12px 0">
@@ -32,6 +33,10 @@ function tiny_product_image(p) {
32
33
 
33
34
  $(document).ready(function() {
34
35
  var that = this;
36
+
37
+ add_to_crumbtrail('/admin', 'Admin');
38
+ add_to_crumbtrail('/admin/products', 'Products');
39
+
35
40
  var table = new IndexTable({
36
41
  form_authenticity_token: '<%= form_authenticity_token %>',
37
42
  container: 'products',
@@ -0,0 +1,90 @@
1
+ <%
2
+ sc = @store_config
3
+ pd = @product_default
4
+ vd = @variant_default
5
+ %>
6
+ <%= render :partial => 'caboose/store/admin_header' %>
7
+
8
+ <h2>Product Defaults</h2>
9
+ <div id='productdefault_<%= pd.id %>_product_vendor_id' ></div>
10
+ <div id='productdefault_<%= pd.id %>_product_option1' ></div>
11
+ <div id='productdefault_<%= pd.id %>_product_option2' ></div>
12
+ <div id='productdefault_<%= pd.id %>_product_option3' ></div>
13
+ <div id='productdefault_<%= pd.id %>_product_status' ></div>
14
+ <div id='productdefault_<%= pd.id %>_product_on_sale' ></div>
15
+ <div id='productdefault_<%= pd.id %>_product_allow_gift_wrap' ></div>
16
+ <div id='productdefault_<%= pd.id %>_product_gift_wrap_price' ></div>
17
+
18
+ <h2>Variant Defaults</h2>
19
+ <div id='variantdefault_<%= vd.id %>_variant_cost' ></div>
20
+ <div id='variantdefault_<%= vd.id %>_variant_price' ></div>
21
+ <div id='variantdefault_<%= vd.id %>_variant_available' ></div>
22
+ <div id='variantdefault_<%= vd.id %>_variant_quantity_in_stock' ></div>
23
+ <div id='variantdefault_<%= vd.id %>_variant_ignore_quantity' ></div>
24
+ <div id='variantdefault_<%= vd.id %>_variant_allow_backorder' ></div>
25
+ <div id='variantdefault_<%= vd.id %>_variant_weight' ></div>
26
+ <div id='variantdefault_<%= vd.id %>_variant_length' ></div>
27
+ <div id='variantdefault_<%= vd.id %>_variant_width' ></div>
28
+ <div id='variantdefault_<%= vd.id %>_variant_height' ></div>
29
+ <div id='variantdefault_<%= vd.id %>_variant_volume' ></div>
30
+ <div id='variantdefault_<%= vd.id %>_variant_cylinder' ></div>
31
+ <div id='variantdefault_<%= vd.id %>_variant_requires_shipping' ></div>
32
+ <div id='variantdefault_<%= vd.id %>_variant_taxable' ></div>
33
+ <div id='variantdefault_<%= vd.id %>_variant_status' ></div>
34
+ <div id='variantdefault_<%= vd.id %>_variant_downloadable' ></div>
35
+ <div id='variantdefault_<%= vd.id %>_variant_is_bundle' ></div>
36
+
37
+ <%= render :partial => 'caboose/store/admin_footer' %>
38
+
39
+ <% content_for :caboose_js do %>
40
+ <script type="text/javascript">
41
+
42
+ $(document).ready(function() {
43
+
44
+ new ModelBinder({
45
+ name: 'ProductDefault',
46
+ id: <%= pd.id %>,
47
+ update_url: '/admin/store',
48
+ authenticity_token: '<%= form_authenticity_token %>',
49
+ attributes: [
50
+ { name: 'product_vendor_id' , nice_name: 'Vendor' , type: 'select' , value: <%= raw Caboose.json(pd.vendor_id ) %>, width: 400, options_url: '/admin/vendors/options' },
51
+ { name: 'product_option1' , nice_name: 'Option 1' , type: 'text' , value: <%= raw Caboose.json(pd.option1 ) %>, width: 400 },
52
+ { name: 'product_option2' , nice_name: 'Option 2' , type: 'text' , value: <%= raw Caboose.json(pd.option2 ) %>, width: 400 },
53
+ { name: 'product_option3' , nice_name: 'Option 3' , type: 'text' , value: <%= raw Caboose.json(pd.option3 ) %>, width: 400 },
54
+ { name: 'product_status' , nice_name: 'Status' , type: 'select' , value: <%= raw Caboose.json(pd.status ) %>, width: 400, options_url: '/admin/products/status-options' },
55
+ { name: 'product_on_sale' , nice_name: 'On Sale' , type: 'checkbox' , value: <%= raw Caboose.json(pd.on_sale ) %>, width: 400 },
56
+ { name: 'product_allow_gift_wrap' , nice_name: 'Allow gift wrap' , type: 'checkbox' , value: <%= raw Caboose.json(pd.allow_gift_wrap ) %>, width: 400 },
57
+ { name: 'product_gift_wrap_price' , nice_name: 'Gift wrap price' , type: 'text' , value: <%= raw Caboose.json(pd.gift_wrap_price ) %>, width: 400 }
58
+ ]
59
+ });
60
+ new ModelBinder({
61
+ name: 'VariantDefault',
62
+ id: <%= vd.id %>,
63
+ update_url: '/admin/store',
64
+ authenticity_token: '<%= form_authenticity_token %>',
65
+ attributes: [
66
+ { name: 'variant_cost' , nice_name: 'Cost' , type: 'text' , value: <%= raw Caboose.json(vd.cost ) %>, width: 400 },
67
+ { name: 'variant_price' , nice_name: 'Price' , type: 'text' , value: <%= raw Caboose.json(vd.price ) %>, width: 400 },
68
+ { name: 'variant_available' , nice_name: 'Available' , type: 'checkbox' , value: <%= raw Caboose.json(vd.available ) %>, width: 400 },
69
+ { name: 'variant_quantity_in_stock' , nice_name: 'Quantity in Stock' , type: 'text' , value: <%= raw Caboose.json(vd.quantity_in_stock ) %>, width: 400 },
70
+ { name: 'variant_ignore_quantity' , nice_name: 'Ignore quantity' , type: 'checkbox' , value: <%= raw Caboose.json(vd.ignore_quantity ) %>, width: 400 },
71
+ { name: 'variant_allow_backorder' , nice_name: 'Allow backorder' , type: 'checkbox' , value: <%= raw Caboose.json(vd.allow_backorder ) %>, width: 400 },
72
+ { name: 'variant_weight' , nice_name: 'Weight' , type: 'text' , value: <%= raw Caboose.json(vd.weight ) %>, width: 400 },
73
+ { name: 'variant_length' , nice_name: 'Length' , type: 'text' , value: <%= raw Caboose.json(vd.length ) %>, width: 400 },
74
+ { name: 'variant_width' , nice_name: 'Width' , type: 'text' , value: <%= raw Caboose.json(vd.width ) %>, width: 400 },
75
+ { name: 'variant_height' , nice_name: 'Height' , type: 'text' , value: <%= raw Caboose.json(vd.height ) %>, width: 400 },
76
+ { name: 'variant_volume' , nice_name: 'Volume' , type: 'text' , value: <%= raw Caboose.json(vd.volume ) %>, width: 400 },
77
+ { name: 'variant_cylinder' , nice_name: 'Cylinder' , type: 'checkbox' , value: <%= raw Caboose.json(vd.cylinder ) %>, width: 400 },
78
+ { name: 'variant_requires_shipping' , nice_name: 'Requires shipping' , type: 'checkbox' , value: <%= raw Caboose.json(vd.requires_shipping ) %>, width: 400 },
79
+ { name: 'variant_taxable' , nice_name: 'Taxable' , type: 'checkbox' , value: <%= raw Caboose.json(vd.taxable ) %>, width: 400 },
80
+ { name: 'variant_status' , nice_name: 'Status' , type: 'select' , value: <%= raw Caboose.json(vd.status ) %>, width: 400 },
81
+ { name: 'variant_status' , nice_name: 'Status' , type: 'select' , value: <%= raw Caboose.json(vd.status ) %>, width: 400 , options_url: '/admin/variants/status-options' },
82
+ { name: 'variant_downloadable' , nice_name: 'Downloadable' , type: 'checkbox' , value: <%= raw Caboose.json(vd.downloadable ) %>, width: 400 },
83
+ { name: 'variant_is_bundle' , nice_name: 'Is bundle' , type: 'checkbox' , value: <%= raw Caboose.json(vd.is_bundle ) %>, width: 400 }
84
+ ]
85
+ });
86
+
87
+ });
88
+
89
+ </script>
90
+ <% end %>
@@ -2,21 +2,19 @@
2
2
  p = @product
3
3
  v = @variant
4
4
  %>
5
- <h1>Edit Variant</h1>
6
- <p><strong>Product:</strong> <%= p.title %></p>
7
- <table>
8
- <tr>
9
- <td valign='top'>
10
- <h2>Options</h2>
11
- <% if p.option1 %><div id='variant_<%= v.id %>_option1'></div><% end %>
12
- <% if p.option2 %><div id='variant_<%= v.id %>_option2'></div><% end %>
13
- <% if p.option3 %><div id='variant_<%= v.id %>_option3'></div><% end %>
5
+ <%= render :partial => 'caboose/products/admin_header' %>
6
+
7
+ <!--<p><strong>Product:</strong> <%= p.title %></p>-->
8
+
9
+ <h2>General Options</h2>
10
+ <% if p.option1 && p.option1.strip.length > 0 %><div id='variant_<%= v.id %>_option1'></div><% end %>
11
+ <% if p.option2 && p.option2.strip.length > 0 %><div id='variant_<%= v.id %>_option2'></div><% end %>
12
+ <% if p.option3 && p.option3.strip.length > 0 %><div id='variant_<%= v.id %>_option3'></div><% end %>
14
13
  <div id='variant_<%= v.id %>_status' ></div>
15
14
  <div id='variant_<%= v.id %>_allow_backorder' ></div>
16
15
  <div id='variant_<%= v.id %>_taxable' ></div>
17
- <div id='variant_<%= v.id %>_downloadable' ></div>
18
16
  <div id='variant_<%= v.id %>_requires_shipping' ></div>
19
- </td><td valign='top'>
17
+
20
18
  <h2>Inventory</h2>
21
19
  <div id='variant_<%= v.id %>_alternate_id' ></div>
22
20
  <div id='variant_<%= v.id %>_sku' ></div>
@@ -25,14 +23,14 @@ v = @variant
25
23
  <div id='variant_<%= v.id %>_price' ></div>
26
24
  <div id='variant_<%= v.id %>_quantity_in_stock' ></div>
27
25
  <div id='variant_<%= v.id %>_ignore_quantity' ></div>
28
- </td><td valign='top'>
26
+
29
27
  <h2>Dimensions</h2>
30
28
  <div id='variant_<%= v.id %>_cylinder' ></div>
31
29
  <div id='variant_<%= v.id %>_weight' ></div>
32
30
  <div id='variant_<%= v.id %>_length' ></div>
33
31
  <div id='variant_<%= v.id %>_width' ></div>
34
32
  <div id='variant_<%= v.id %>_height' ></div>
35
- </td><td valign='top'>
33
+
36
34
  <h2>Sale</h2>
37
35
  <div id='variant_<%= v.id %>_sale_price' ></div>
38
36
  <div id='variant_<%= v.id %>_date_sale_starts' ></div>
@@ -41,32 +39,45 @@ v = @variant
41
39
  <div id='variant_<%= v.id %>_time_sale_ends' ></div>
42
40
  <div id='variant_<%= v.id %>_clearance' ></div>
43
41
  <div id='variant_<%= v.id %>_clearance_price' ></div>
44
- </td>
45
- <td valign='top' colspan='4'4>
42
+
46
43
  <h2>Flat Rate Shipping</h2>
47
44
  <div id='variant_<%= v.id %>_flat_rate_shipping' ></div>
48
45
  <div id='variant_<%= v.id %>_flat_rate_shipping_single' ></div>
49
46
  <div id='variant_<%= v.id %>_flat_rate_shipping_combined' ></div>
50
47
  <div id='variant_<%= v.id %>_flat_rate_shipping_package_method_id'></div>
51
- </td>
52
- </tr>
53
- </table>
48
+
49
+ <h2>Downloadable Options</h2>
50
+ <div id='variant_<%= v.id %>_downloadable' ></div>
54
51
  <div id='variant_<%= v.id %>_download_path' ></div>
52
+ <p><input type='button' value='Generate Download URL' onclick="download_url();" /></p>
53
+
54
+ <h2>Bundling</h2>
55
+ <div id='variant_<%= v.id %>_is_bundle'></div>
56
+ <div id='variant_children'></div>
57
+
58
+ <h2>Delete Variant</h2>
55
59
  <div id='message'></div>
56
- <p>
57
- <input type='button' value='< Back' onclick="window.location='/admin/products/<%= p.id %>/variants';" />
58
- <input type='button' value='Generate Download URL' onclick="download_url();" />
59
- <input type='button' value='Delete Variant' onclick="delete_variant(<%= v.id %>);" />
60
- </p>
60
+ <p><input type='button' value='Delete Variant' onclick="delete_variant(<%= v.id %>);" /></p>
61
+
62
+ <%= render :partial => 'caboose/products/admin_footer' %>
61
63
 
62
64
  <% content_for :caboose_js do %>
63
65
  <%= javascript_include_tag "caboose/model/all" %>
64
66
  <%= javascript_include_tag "caboose/admin_products" %>
67
+ <%= javascript_include_tag "caboose/variant_children_controller" %>
65
68
  <script type='text/javascript'>
66
69
  <%
67
70
  sc = @site.store_config
68
71
  %>
72
+ var vcc = false;
69
73
  $(document).ready(function() {
74
+
75
+ add_to_crumbtrail('/admin', 'Admin');
76
+ add_to_crumbtrail('/admin/products', 'Products');
77
+ add_to_crumbtrail('/admin/products/<%= p.id %>', <%= raw Caboose.json(p.title) %>);
78
+ add_to_crumbtrail('/admin/products/<%= p.id %>/variants', 'Inventory & Variants');
79
+ add_to_crumbtrail('/admin/products/<%= p.id %>/variants/<%= v.id %>', <%= raw Caboose.json(v.options.count > 0 ? v.options.join(', ') : 'Default Variant') %>);
80
+
70
81
  m = new ModelBinder({
71
82
  name: 'Variant',
72
83
  id: <%= v.id %>,
@@ -105,9 +116,23 @@ $(document).ready(function() {
105
116
  { name: 'flat_rate_shipping_package_method_id' , nice_name: 'Package method' , type: 'select' , align: 'right' , width: 250, options_url: '/admin/shipping-packages/package-method-options',
106
117
  value: <%= raw Caboose.json("#{v.flat_rate_shipping_package_id}_#{v.flat_rate_shipping_method_id}") %>,
107
118
  text: <%= raw Caboose.json(v.flat_rate_shipping_package && v.flat_rate_shipping_method ? "#{v.flat_rate_shipping_package.name} - #{v.flat_rate_shipping_method.service_name}" : '') %>
108
- }
119
+ },
120
+ { name: 'is_bundle' , nice_name: 'Is Bundle' , type: 'checkbox' , align: 'right' , width: 175, value: <%= raw Caboose.json(v.is_bundle ? 1 : 0 ) %> ,
121
+ after_update: function() {
122
+ if ($('#variant_<%= v.id %>_is_bundle').is(':checked'))
123
+ vcc.print();
124
+ else
125
+ vcc.hide();
126
+ }
127
+ }
109
128
  ]
110
- });
129
+ });
130
+ vcc = new VariantChildrenController({
131
+ product_id: <%= v.product_id %>,
132
+ variant_id: <%= v.id %>,
133
+ authenticity_token: '<%= raw form_authenticity_token %>',
134
+ hide_on_init: <% if v.is_bundle %>false<% else %>true<% end %>
135
+ });
111
136
  });
112
137
 
113
138
  function download_url(expires_in)
@@ -57,6 +57,12 @@ sc = @site.store_config
57
57
 
58
58
  $(document).ready(function() {
59
59
  var that = this;
60
+
61
+ add_to_crumbtrail('/admin', 'Admin');
62
+ add_to_crumbtrail('/admin/products', 'Products');
63
+ add_to_crumbtrail('/admin/products/<%= p.id %>', <%= raw Caboose.json(p.title) %>);
64
+ add_to_crumbtrail('/admin/products/<%= p.id %>/variants', 'Inventory & Variants');
65
+
60
66
  var table = new IndexTable({
61
67
  form_authenticity_token: '<%= form_authenticity_token %>',
62
68
  container: 'variants',
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.8.24'
2
+ VERSION = '0.8.25'
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.8.24
4
+ version: 0.8.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-18 00:00:00.000000000 Z
11
+ date: 2016-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -600,6 +600,7 @@ files:
600
600
  - app/assets/javascripts/caboose/station.js
601
601
  - app/assets/javascripts/caboose/testing.js
602
602
  - app/assets/javascripts/caboose/united_states.js
603
+ - app/assets/javascripts/caboose/variant_children_controller.js
603
604
  - app/assets/javascripts/chartjs/Chart.min.js
604
605
  - app/assets/javascripts/chartjs/gulpfile.js
605
606
  - app/assets/javascripts/plupload/Moxie.swf
@@ -794,6 +795,7 @@ files:
794
795
  - app/controllers/caboose/store_controller.rb
795
796
  - app/controllers/caboose/subscriptions_controller.rb
796
797
  - app/controllers/caboose/users_controller.rb
798
+ - app/controllers/caboose/variant_children_controller.rb
797
799
  - app/controllers/caboose/variants_controller.rb
798
800
  - app/controllers/caboose/vendors_controller.rb
799
801
  - app/helpers/caboose/application_helper.rb
@@ -883,6 +885,7 @@ files:
883
885
  - app/models/caboose/post_custom_field_value.rb
884
886
  - app/models/caboose/product.rb
885
887
  - app/models/caboose/product_category_sort.rb
888
+ - app/models/caboose/product_default.rb
886
889
  - app/models/caboose/product_image.rb
887
890
  - app/models/caboose/product_image_variant.rb
888
891
  - app/models/caboose/retargeting_config.rb
@@ -914,6 +917,8 @@ files:
914
917
  - app/models/caboose/user_subscription.rb
915
918
  - app/models/caboose/utilities/schema.rb
916
919
  - app/models/caboose/variant.rb
920
+ - app/models/caboose/variant_child.rb
921
+ - app/models/caboose/variant_default.rb
917
922
  - app/models/caboose/vendor.rb
918
923
  - app/models/caboose/wish_list.rb
919
924
  - app/models/caboose/wish_list_line_item.rb
@@ -1170,6 +1175,7 @@ files:
1170
1175
  - app/views/caboose/station/index.html.erb
1171
1176
  - app/views/caboose/store/_admin_footer.html.erb
1172
1177
  - app/views/caboose/store/_admin_header.html.erb
1178
+ - app/views/caboose/store/admin_edit_defaults.html.erb
1173
1179
  - app/views/caboose/store/admin_edit_general.html.erb
1174
1180
  - app/views/caboose/store/admin_edit_packages.html.erb
1175
1181
  - app/views/caboose/store/admin_edit_payment.html.erb