caboose-cms 0.8.19 → 0.8.20

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: 9358c4e426e2ac03fbb5cadc8906d0bb3f56c622
4
- data.tar.gz: 3f2f75073157e3e4ff49ac36b9709ae65c059c65
3
+ metadata.gz: c2144d44f9229569d71d7f708f862c3308f43191
4
+ data.tar.gz: 5dda1148bf82a6bf1956b7bfecd379dbd93d3eec
5
5
  SHA512:
6
- metadata.gz: ed6dc00cb2f42e15cfdb9ef37db29e983e9af887c34722cdb4b4c3a304ec066572afa394df3fbcf459a98d0f747a8cd55abbd6f6dca70f632a0656d5462a454a
7
- data.tar.gz: 67b0a26a36ceee5e3e406c6ebcb5742208abe7a1ed8cbd3905d81e8a187673f42aa75eb2192ba5c76bcc0c94629df3cc535cadd8dca65a5b1766c221a23e740a
6
+ metadata.gz: bf47900e3d42c50af343fc33edc177b123111529b808f6f5958b76749a377c03533106e9d6e1efc5f805a32c69bda382ac2530194c8315169465f26383a891ca
7
+ data.tar.gz: 2699c567d70870f7ba74f1036c4023a210685328bcde81fc2c69a712c993ed600041bada712e4a8cf54cdf0f625e6a678a887257e95ca6897a1a968c243c7f21
@@ -242,6 +242,87 @@ module Caboose
242
242
  render :json => { :success => true }
243
243
  end
244
244
 
245
+ # @route PUT /admin/products/:product_id/variants/bulk
246
+ def admin_bulk_update
247
+ return unless user_is_allowed_to 'edit', 'sites'
248
+
249
+ resp = Caboose::StdClass.new
250
+ variants = params[:model_ids].collect{ |variant_id| Variant.find(variant_id) }
251
+
252
+ save = true
253
+ params.each do |k,value|
254
+ case k
255
+ when 'alternate_id' then variants.each { |v| v.alternate_id = value }
256
+ when 'sku' then variants.each { |v| v.sku = value }
257
+ when 'barcode' then variants.each { |v| v.barcode = value }
258
+ when 'price' then variants.each { |v| v.price = value }
259
+ when 'quantity_in_stock' then variants.each { |v| v.quantity_in_stock = value }
260
+ when 'ignore_quantity' then variants.each { |v| v.ignore_quantity = value }
261
+ when 'allow_backorder' then variants.each { |v| v.allow_backorder = value }
262
+ when 'clearance' then variants.each { |v| v.clearance = value }
263
+ when 'clearance_price' then variants.each { |v| v.clearance_price = value }
264
+ when 'status' then variants.each { |v| v.status = value }
265
+ when 'weight' then variants.each { |v| v.weight = value }
266
+ when 'length' then variants.each { |v| v.length = value }
267
+ when 'width' then variants.each { |v| v.width = value }
268
+ when 'height' then variants.each { |v| v.height = value }
269
+ when 'option1' then variants.each { |v| v.option1 = value }
270
+ when 'option2' then variants.each { |v| v.option2 = value }
271
+ when 'option3' then variants.each { |v| v.option3 = value }
272
+ when 'option1_media_id' then variants.each { |v| v.option1_media_id = value }
273
+ when 'option2_media_id' then variants.each { |v| v.option2_media_id = value }
274
+ when 'option3_media_id' then variants.each { |v| v.option3_media_id = value }
275
+ when 'requires_shipping' then variants.each { |v| v.requires_shipping = value }
276
+ when 'taxable' then variants.each { |v| v.taxable = value }
277
+ when 'downloadable' then variants.each { |v| v.downloadable = value }
278
+ when 'download_path' then variants.each { |v| v.download_path = value }
279
+
280
+ when 'sale_price'
281
+ variants.each_with_index do |v, i|
282
+ v.sale_price = value
283
+ v.product.delay(:run_at => 3.seconds.from_now, :queue => 'caboose_store').update_on_sale if i == 0
284
+ end
285
+ when 'date_sale_starts'
286
+ variants.each_with_index do |v, i|
287
+ v.date_sale_starts = ModelBinder.update_date(v.date_sale_starts, value, @logged_in_user.timezone)
288
+ if i == 0
289
+ v.product.delay(:run_at => v.date_sale_starts, :queue => 'caboose_store').update_on_sale
290
+ v.product.delay(:run_at => 3.seconds.from_now, :queue => 'caboose_store').update_on_sale
291
+ end
292
+ end
293
+ when 'time_sale_starts'
294
+ variants.each_with_index do |v, i|
295
+ v.date_sale_starts = ModelBinder.update_time(v.date_sale_starts, value, @logged_in_user.timezone)
296
+ if i == 0
297
+ v.product.delay(:run_at => v.date_sale_starts, :queue => 'caboose_store').update_on_sale
298
+ v.product.delay(:run_at => 3.seconds.from_now, :queue => 'caboose_store').update_on_sale
299
+ end
300
+ end
301
+ when 'date_sale_ends'
302
+ variants.each_with_index do |v, i|
303
+ v.date_sale_ends = ModelBinder.update_date(v.date_sale_ends, value, @logged_in_user.timezone)
304
+ if i == 0
305
+ v.product.delay(:run_at => v.date_sale_ends , :queue => 'caboose_store').update_on_sale
306
+ v.product.delay(:run_at => 3.seconds.from_now, :queue => 'caboose_store').update_on_sale
307
+ end
308
+ end
309
+ when 'time_sale_ends'
310
+ variants.each_with_index do |v, i|
311
+ v.date_sale_ends = ModelBinder.update_time(v.date_sale_ends, value, @logged_in_user.timezone)
312
+ if i == 0
313
+ v.product.delay(:run_at => v.date_sale_ends , :queue => 'caboose_store').update_on_sale
314
+ v.product.delay(:run_at => 3.seconds.from_now, :queue => 'caboose_store').update_on_sale
315
+ end
316
+ end
317
+
318
+ end
319
+ end
320
+ variants.each{ |v| v.save }
321
+
322
+ resp.success = true
323
+ render :json => resp
324
+ end
325
+
245
326
  # @route PUT /admin/products/:product_id/variants/:id
246
327
  def admin_update
247
328
  return if !user_is_allowed('variants', 'edit')
@@ -406,87 +487,6 @@ module Caboose
406
487
  render :json => resp
407
488
  end
408
489
 
409
- # @route PUT /admin/products/:product_id/variants/bulk
410
- def admin_bulk_update
411
- return unless user_is_allowed_to 'edit', 'sites'
412
-
413
- resp = Caboose::StdClass.new
414
- variants = params[:model_ids].collect{ |variant_id| Variant.find(variant_id) }
415
-
416
- save = true
417
- params.each do |k,value|
418
- case k
419
- when 'alternate_id' then variants.each { |v| v.alternate_id = value }
420
- when 'sku' then variants.each { |v| v.sku = value }
421
- when 'barcode' then variants.each { |v| v.barcode = value }
422
- when 'price' then variants.each { |v| v.price = value }
423
- when 'quantity_in_stock' then variants.each { |v| v.quantity_in_stock = value }
424
- when 'ignore_quantity' then variants.each { |v| v.ignore_quantity = value }
425
- when 'allow_backorder' then variants.each { |v| v.allow_backorder = value }
426
- when 'clearance' then variants.each { |v| v.clearance = value }
427
- when 'clearance_price' then variants.each { |v| v.clearance_price = value }
428
- when 'status' then variants.each { |v| v.status = value }
429
- when 'weight' then variants.each { |v| v.weight = value }
430
- when 'length' then variants.each { |v| v.length = value }
431
- when 'width' then variants.each { |v| v.width = value }
432
- when 'height' then variants.each { |v| v.height = value }
433
- when 'option1' then variants.each { |v| v.option1 = value }
434
- when 'option2' then variants.each { |v| v.option2 = value }
435
- when 'option3' then variants.each { |v| v.option3 = value }
436
- when 'option1_media_id' then variants.each { |v| v.option1_media_id = value }
437
- when 'option2_media_id' then variants.each { |v| v.option2_media_id = value }
438
- when 'option3_media_id' then variants.each { |v| v.option3_media_id = value }
439
- when 'requires_shipping' then variants.each { |v| v.requires_shipping = value }
440
- when 'taxable' then variants.each { |v| v.taxable = value }
441
- when 'downloadable' then variants.each { |v| v.downloadable = value }
442
- when 'download_path' then variants.each { |v| v.download_path = value }
443
-
444
- when 'sale_price'
445
- variants.each_with_index do |v, i|
446
- v.sale_price = value
447
- v.product.delay(:run_at => 3.seconds.from_now, :queue => 'caboose_store').update_on_sale if i == 0
448
- end
449
- when 'date_sale_starts'
450
- variants.each_with_index do |v, i|
451
- v.date_sale_starts = ModelBinder.update_date(v.date_sale_starts, value, @logged_in_user.timezone)
452
- if i == 0
453
- v.product.delay(:run_at => v.date_sale_starts, :queue => 'caboose_store').update_on_sale
454
- v.product.delay(:run_at => 3.seconds.from_now, :queue => 'caboose_store').update_on_sale
455
- end
456
- end
457
- when 'time_sale_starts'
458
- variants.each_with_index do |v, i|
459
- v.date_sale_starts = ModelBinder.update_time(v.date_sale_starts, value, @logged_in_user.timezone)
460
- if i == 0
461
- v.product.delay(:run_at => v.date_sale_starts, :queue => 'caboose_store').update_on_sale
462
- v.product.delay(:run_at => 3.seconds.from_now, :queue => 'caboose_store').update_on_sale
463
- end
464
- end
465
- when 'date_sale_ends'
466
- variants.each_with_index do |v, i|
467
- v.date_sale_ends = ModelBinder.update_date(v.date_sale_ends, value, @logged_in_user.timezone)
468
- if i == 0
469
- v.product.delay(:run_at => v.date_sale_ends , :queue => 'caboose_store').update_on_sale
470
- v.product.delay(:run_at => 3.seconds.from_now, :queue => 'caboose_store').update_on_sale
471
- end
472
- end
473
- when 'time_sale_ends'
474
- variants.each_with_index do |v, i|
475
- v.date_sale_ends = ModelBinder.update_time(v.date_sale_ends, value, @logged_in_user.timezone)
476
- if i == 0
477
- v.product.delay(:run_at => v.date_sale_ends , :queue => 'caboose_store').update_on_sale
478
- v.product.delay(:run_at => 3.seconds.from_now, :queue => 'caboose_store').update_on_sale
479
- end
480
- end
481
-
482
- end
483
- end
484
- variants.each{ |v| v.save }
485
-
486
- resp.success = true
487
- render :json => resp
488
- end
489
-
490
490
  # @route POST /admin/products/:product_id/variants/remove
491
491
  def admin_remove_variants
492
492
  params[:variant_ids].each do |variant_id|
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.8.19'
2
+ VERSION = '0.8.20'
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.19
4
+ version: 0.8.20
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-14 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg