caboose-cms 0.8.14 → 0.8.15

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: c57cbf7b704ca810d459481fddd217b78e117e43
4
- data.tar.gz: 51b4bad81ece4cf9b6f932f315cdbf40eda65275
3
+ metadata.gz: aa3fb1432258306db56b298525446cec698aef03
4
+ data.tar.gz: af42acc488025424bde48a48764fb0f26f429289
5
5
  SHA512:
6
- metadata.gz: c148c323f4e21c42e243fe165361553db483b57b5b27a37c24dd57aa9d05189b5bd29513ac1635291149513093675204aa5cd18b7a441d5ba09d8ab8bca07fe4
7
- data.tar.gz: c735ecab394697f62a3d4a022056db7d15efe77e20180a6ec71e22852d366413cc2d2421b7b9718bc53b36193f118042cc26154e3f6d735cc78ccc27cd7c0f2d
6
+ metadata.gz: 7de9d53efb3a7144a5cca592a972d866f0b67c1654f650b98a37021b80108c3cf8bd6ee92736f25e42dd450d74b17162b6d82850ee51b7a88dc81308107a8f14
7
+ data.tar.gz: d54163fb97e4ad21788e95524576e7ae6882fada323db3090740b9105b59a0c9d98fa694efe1c3e77b3eb05e99e15cbf510432d22d5d5558ead87bc5bc51f654
@@ -65,7 +65,7 @@ module Caboose
65
65
  query = ["select P.id, P.title from store_category_memberships CM
66
66
  left join store_products P on P.id = CM.product_id
67
67
  where CM.category_id = ? AND P.status = 'Active'
68
- order by CM.sort_order, P.title", params[:id]]
68
+ order by CM.sort_order, P.title", params[:category_id]]
69
69
  rows = ActiveRecord::Base.connection.select_rows(ActiveRecord::Base.send(:sanitize_sql_array, query))
70
70
  arr = rows.collect{ |row| { :id => row[0], :title => row[1] }}
71
71
  render :json => arr
@@ -148,65 +148,6 @@ module Caboose
148
148
  @product = @variant.product
149
149
  render :layout => 'caboose/admin'
150
150
  end
151
-
152
- # @route PUT /admin/products/:product_id/variants/:id
153
- def admin_update
154
- return if !user_is_allowed('variants', 'edit')
155
-
156
- resp = Caboose::StdClass.new({'attributes' => {}})
157
- v = Variant.find(params[:id])
158
-
159
- save = true
160
- params.each do |name,value|
161
- case name
162
- when 'alternate_id' then v.alternate_id = value
163
- when 'sku' then v.sku = value
164
- when 'barcode' then v.barcode = value
165
- when 'cost' then v.cost = value
166
- when 'price' then v.price = value
167
- when 'quantity_in_stock' then v.quantity_in_stock = value
168
- when 'ignore_quantity' then v.ignore_quantity = value
169
- when 'allow_backorder' then v.allow_backorder = value
170
- when 'clearance' then v.clearance = value
171
- when 'clearance_price' then v.clearance_price = value
172
- when 'status' then v.status = value
173
- when 'weight' then v.weight = value
174
- when 'length' then v.length = value
175
- when 'width' then v.width = value
176
- when 'height' then v.height = value
177
- when 'option1' then v.option1 = value
178
- when 'option2' then v.option2 = value
179
- when 'option3' then v.option3 = value
180
- when 'requires_shipping' then v.requires_shipping = value
181
- when 'taxable' then v.taxable = value
182
- when 'flat_rate_shipping' then v.flat_rate_shipping = value
183
- when 'flat_rate_shipping_single' then v.flat_rate_shipping_single = value
184
- when 'flat_rate_shipping_combined' then v.flat_rate_shipping_combined = value
185
- when 'flat_rate_shipping_package_id' then v.flat_rate_shipping_package_id = value
186
- when 'flat_rate_shipping_method_id' then v.flat_rate_shipping_method_id = value
187
- when 'flat_rate_shipping_package_method_id' then
188
- arr = value.split('_')
189
- v.flat_rate_shipping_package_id = arr[0].to_i
190
- v.flat_rate_shipping_method_id = arr[1].to_i
191
- when 'downloadable' then v.downloadable = value
192
- when 'download_path' then v.download_path = value
193
-
194
- when 'sale_price'
195
- v.sale_price = value
196
- v.product.delay(:run_at => 3.seconds.from_now).update_on_sale
197
- when 'date_sale_starts'
198
- v.date_sale_starts = ModelBinder.local_datetime_to_utc(value, @logged_in_user.timezone)
199
- v.product.delay(:run_at => v.date_sale_starts).update_on_sale
200
- v.product.delay(:run_at => 3.seconds.from_now).update_on_sale
201
- when 'date_sale_ends'
202
- v.date_sale_ends = ModelBinder.local_datetime_to_utc(value, @logged_in_user.timezone)
203
- v.product.delay(:run_at => v.date_sale_ends).update_on_sale
204
- v.product.delay(:run_at => 3.seconds.from_now).update_on_sale
205
- end
206
- end
207
- resp.success = save && v.save
208
- render :json => resp
209
- end
210
151
 
211
152
  # @route PUT /admin/products/:product_id/variants/:id/attach-to-image
212
153
  def admin_attach_to_image
@@ -300,6 +241,65 @@ module Caboose
300
241
  end
301
242
  render :json => { :success => true }
302
243
  end
244
+
245
+ # @route PUT /admin/products/:product_id/variants/:id
246
+ def admin_update
247
+ return if !user_is_allowed('variants', 'edit')
248
+
249
+ resp = Caboose::StdClass.new({'attributes' => {}})
250
+ v = Variant.find(params[:id])
251
+
252
+ save = true
253
+ params.each do |name,value|
254
+ case name
255
+ when 'alternate_id' then v.alternate_id = value
256
+ when 'sku' then v.sku = value
257
+ when 'barcode' then v.barcode = value
258
+ when 'cost' then v.cost = value
259
+ when 'price' then v.price = value
260
+ when 'quantity_in_stock' then v.quantity_in_stock = value
261
+ when 'ignore_quantity' then v.ignore_quantity = value
262
+ when 'allow_backorder' then v.allow_backorder = value
263
+ when 'clearance' then v.clearance = value
264
+ when 'clearance_price' then v.clearance_price = value
265
+ when 'status' then v.status = value
266
+ when 'weight' then v.weight = value
267
+ when 'length' then v.length = value
268
+ when 'width' then v.width = value
269
+ when 'height' then v.height = value
270
+ when 'option1' then v.option1 = value
271
+ when 'option2' then v.option2 = value
272
+ when 'option3' then v.option3 = value
273
+ when 'requires_shipping' then v.requires_shipping = value
274
+ when 'taxable' then v.taxable = value
275
+ when 'flat_rate_shipping' then v.flat_rate_shipping = value
276
+ when 'flat_rate_shipping_single' then v.flat_rate_shipping_single = value
277
+ when 'flat_rate_shipping_combined' then v.flat_rate_shipping_combined = value
278
+ when 'flat_rate_shipping_package_id' then v.flat_rate_shipping_package_id = value
279
+ when 'flat_rate_shipping_method_id' then v.flat_rate_shipping_method_id = value
280
+ when 'flat_rate_shipping_package_method_id' then
281
+ arr = value.split('_')
282
+ v.flat_rate_shipping_package_id = arr[0].to_i
283
+ v.flat_rate_shipping_method_id = arr[1].to_i
284
+ when 'downloadable' then v.downloadable = value
285
+ when 'download_path' then v.download_path = value
286
+
287
+ when 'sale_price'
288
+ v.sale_price = value
289
+ v.product.delay(:run_at => 3.seconds.from_now).update_on_sale
290
+ when 'date_sale_starts'
291
+ v.date_sale_starts = ModelBinder.local_datetime_to_utc(value, @logged_in_user.timezone)
292
+ v.product.delay(:run_at => v.date_sale_starts).update_on_sale
293
+ v.product.delay(:run_at => 3.seconds.from_now).update_on_sale
294
+ when 'date_sale_ends'
295
+ v.date_sale_ends = ModelBinder.local_datetime_to_utc(value, @logged_in_user.timezone)
296
+ v.product.delay(:run_at => v.date_sale_ends).update_on_sale
297
+ v.product.delay(:run_at => 3.seconds.from_now).update_on_sale
298
+ end
299
+ end
300
+ resp.success = save && v.save
301
+ render :json => resp
302
+ end
303
303
 
304
304
  # @route GET /admin/variants/group
305
305
  def admin_group
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.8.14'
2
+ VERSION = '0.8.15'
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.14
4
+ version: 0.8.15
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-06-27 00:00:00.000000000 Z
11
+ date: 2016-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg