caboose-cms 0.9.159 → 0.9.160

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b030181f03b4077e4f7e1fd2fd28d66c02e82667
4
- data.tar.gz: 0e3de25600faf23aa943a64c412bb0202e0db2a5
3
+ metadata.gz: 18a19403ebb7d091161c0bf97843cd91c7573fd2
4
+ data.tar.gz: 3fc93361bb986d6c424e1297b76393c015ab4154
5
5
  SHA512:
6
- metadata.gz: 43da331f80999b42f42fc037acc2d277c0c74e2fdc08f47312b3df9311ac1561bf7a432b0687362231bd3ef43754dcf1e23af565687c28ba39bdecb73389fbac
7
- data.tar.gz: 686d9ccbb93d77c7c55e9e8f93ea2a41049ff9eb192e0e240650f61622cdd671a5e31dbfd8dc2a36716391baee1491417c16fed2e82c26f87c9b30d3dd321931
6
+ metadata.gz: 38b692eedce3c1d3e639cea48f8da9d5203b6e9f1025c68ac263ee27aae1f5c990d837a6e17510434fa0786c2c6b4814e5b8a958f7c31fe898ed1610a034e9ad
7
+ data.tar.gz: ba0d6090ad712ff13489b235ee6effc0aab02591d3a6150efa206a2184b09093145255049205e37372666cb440b95a119677b1466564f065589572467ebc10ff
@@ -461,28 +461,28 @@ module Caboose
461
461
  when 'stackable_group_id' then product.stackable_group_id = value
462
462
  when 'allow_gift_wrap' then product.allow_gift_wrap = value
463
463
  when 'gift_wrap_price' then product.gift_wrap_price = value
464
- when 'option1' then product.option1 = value
465
- when 'option2' then product.option2 = value
466
- when 'option3' then product.option3 = value
464
+ when 'option1' then product.option1 = (value.blank? ? nil : value)
465
+ when 'option2' then product.option2 = (value.blank? ? nil : value)
466
+ when 'option3' then product.option3 = (value.blank? ? nil : value)
467
467
  when 'option1_media' then product.option1_media = value
468
468
  when 'option2_media' then product.option2_media = value
469
469
  when 'option3_media' then product.option3_media = value
470
470
  when 'default1'
471
- product.default1 = value
471
+ product.default1 = (value.blank? ? nil : value)
472
472
  Variant.where(:product_id => product.id, :option1 => nil).each do |p|
473
- p.option1 = value
473
+ p.option1 = (value.blank? ? nil : value)
474
474
  p.save
475
475
  end
476
476
  when 'default2'
477
- product.default2 = value
477
+ product.default2 = (value.blank? ? nil : value)
478
478
  Variant.where(:product_id => product.id, :option2 => nil).each do |p|
479
- p.option2 = value
479
+ p.option2 = (value.blank? ? nil : value)
480
480
  p.save
481
481
  end
482
482
  when 'default3'
483
- product.default3 = value
483
+ product.default3 = (value.blank? ? nil : value)
484
484
  Variant.where(:product_id => product.id, :option3 => nil).each do |p|
485
- p.option3 = value
485
+ p.option3 = (value.blank? ? nil : value)
486
486
  p.save
487
487
  end
488
488
  when 'date_available'
@@ -214,7 +214,8 @@ module Caboose
214
214
  def admin_update_option1_sort_order
215
215
  product_id = params[:product_id]
216
216
  params[:values].each_with_index do |value, i|
217
- Variant.where(:product_id => product_id, :option1 => value).all.each do |v|
217
+ val = value.gsub('AMPERSAND','&')
218
+ Variant.where(:product_id => product_id, :option1 => val).all.each do |v|
218
219
  v.update_attribute(:option1_sort_order, i)
219
220
  end
220
221
  end
@@ -225,7 +226,8 @@ module Caboose
225
226
  def admin_update_option2_sort_order
226
227
  product_id = params[:product_id]
227
228
  params[:values].each_with_index do |value, i|
228
- Variant.where(:product_id => product_id, :option2 => value).all.each do |v|
229
+ val = value.gsub('AMPERSAND','&')
230
+ Variant.where(:product_id => product_id, :option2 => val).all.each do |v|
229
231
  v.update_attribute(:option2_sort_order, i)
230
232
  end
231
233
  end
@@ -236,7 +238,8 @@ module Caboose
236
238
  def admin_update_option3_sort_order
237
239
  product_id = params[:product_id]
238
240
  params[:values].each_with_index do |value, i|
239
- Variant.where(:product_id => product_id, :option3 => value).all.each do |v|
241
+ val = value.gsub('AMPERSAND','&')
242
+ Variant.where(:product_id => product_id, :option3 => val).all.each do |v|
240
243
  v.update_attribute(:option3_sort_order, i)
241
244
  end
242
245
  end
@@ -269,9 +272,9 @@ module Caboose
269
272
  when 'length' then variants.each { |v| v.length = value }
270
273
  when 'width' then variants.each { |v| v.width = value }
271
274
  when 'height' then variants.each { |v| v.height = value }
272
- when 'option1' then variants.each { |v| v.option1 = value }
273
- when 'option2' then variants.each { |v| v.option2 = value }
274
- when 'option3' then variants.each { |v| v.option3 = value }
275
+ when 'option1' then variants.each { |v| v.option1 = (value.blank? ? nil : value) }
276
+ when 'option2' then variants.each { |v| v.option2 = (value.blank? ? nil : value) }
277
+ when 'option3' then variants.each { |v| v.option3 = (value.blank? ? nil : value) }
275
278
  when 'option1_media_id' then variants.each { |v| v.option1_media_id = value }
276
279
  when 'option2_media_id' then variants.each { |v| v.option2_media_id = value }
277
280
  when 'option3_media_id' then variants.each { |v| v.option3_media_id = value }
@@ -80,13 +80,25 @@ p = @product
80
80
  <% content_for :caboose_js do %>
81
81
  <script type='text/javascript'>
82
82
 
83
+ function serial(values) {
84
+ var str = values.replace(/&values\[\]=/g,'|SPLIT|').replace(/values\[\]=/g,'|SPLIT|');
85
+ var arr = str.split('|SPLIT|');
86
+ var new_arr = [];
87
+ $.each(arr, function(k,v) {
88
+ if ( v != '' && v != null )
89
+ new_arr.push( v.replace('&','AMPERSAND') )
90
+ });
91
+ var new_str = 'values[]=' + new_arr.join('&values[]=');
92
+ return new_str;
93
+ }
94
+
83
95
  $(document).ready(function() {
84
96
  $('#option1').sortable({
85
97
  update: function(event, ui) {
86
98
  $.ajax({
87
99
  url: '/admin/products/<%= p.id %>/variants/option1-sort-order',
88
100
  type: 'put',
89
- data: $('#option1').sortable('serialize'),
101
+ data: serial($('#option1').sortable('serialize')),
90
102
  success: function(resp) {}
91
103
  });
92
104
  }
@@ -96,7 +108,7 @@ $(document).ready(function() {
96
108
  $.ajax({
97
109
  url: '/admin/products/<%= p.id %>/variants/option2-sort-order',
98
110
  type: 'put',
99
- data: $('#option2').sortable('serialize'),
111
+ data: serial($('#option2').sortable('serialize')),
100
112
  success: function(resp) {}
101
113
  });
102
114
  }
@@ -106,7 +118,7 @@ $(document).ready(function() {
106
118
  $.ajax({
107
119
  url: '/admin/products/<%= p.id %>/variants/option3-sort-order',
108
120
  type: 'put',
109
- data: $('#option3').sortable('serialize'),
121
+ data: serial($('#option3').sortable('serialize')),
110
122
  success: function(resp) {}
111
123
  });
112
124
  }
@@ -72,12 +72,12 @@ $(document).ready(function() {
72
72
  allow_duplicate: false,
73
73
  allow_advanced_edit: true,
74
74
  fields: [
75
- <% 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' , bulk_edit: true },<% end %>
76
- <% 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' , bulk_edit: true },<% end %>
77
- <% 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' , bulk_edit: true },<% end %>
75
+ <% 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: 200, align: 'left' , bulk_edit: true },<% end %>
76
+ <% 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: 200, align: 'left' , bulk_edit: true },<% end %>
77
+ <% 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: 200, align: 'left' , bulk_edit: true },<% end %>
78
78
  { show: true , name: 'status' , nice_name: 'Status' , sort: 'status' , type: 'select' , options_url: '/admin/variants/status-options', value: function(v) { return v.status }, width: 75, align: 'left' , bulk_edit: true },
79
- { 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' , bulk_edit: true },
80
- { show: true , name: 'sku' , nice_name: 'SKU' , sort: 'sku' , type: 'text' , value: function(v) { return v.sku }, width: 75, align: 'left' , bulk_edit: true },
79
+ { show: true , name: 'alternate_id' , nice_name: 'Alternate ID' , sort: 'alternate_id' , type: 'text' , value: function(v) { return v.alternate_id }, width: 150, align: 'left' , bulk_edit: true },
80
+ { show: true , name: 'sku' , nice_name: 'SKU' , sort: 'sku' , type: 'text' , value: function(v) { return v.sku }, width: 150, align: 'left' , bulk_edit: true },
81
81
  { show: false , name: 'barcode' , nice_name: 'Barcode' , sort: 'barcode' , type: 'text' , value: function(v) { return v.barcode }, width: 75, align: 'left' , bulk_edit: true },
82
82
  { show: true , name: 'cost' , nice_name: 'Cost of Goods' , sort: 'cost' , type: 'text' , value: function(v) { return v.cost }, width: 75, align: 'right' , bulk_edit: true },
83
83
  { show: true , name: 'price' , nice_name: 'Price' , sort: 'price' , type: 'text' , value: function(v) { return v.price }, width: 75, align: 'right' , bulk_edit: true },
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.159'
2
+ VERSION = '0.9.160'
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.9.159
4
+ version: 0.9.160
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-03 00:00:00.000000000 Z
11
+ date: 2018-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg