caboose-cms 0.5.64 → 0.5.66

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +8 -8
  2. data/app/assets/javascripts/caboose/admin.js +1 -1
  3. data/app/assets/javascripts/caboose/admin_edit_order.js +724 -0
  4. data/app/assets/javascripts/caboose/cart2.js +4 -4
  5. data/app/assets/javascripts/caboose/model/index_table.js +122 -80
  6. data/app/assets/stylesheets/caboose/admin_main.css +8 -0
  7. data/app/controllers/caboose/application_controller.rb +1 -1
  8. data/app/controllers/caboose/block_type_sources_controller.rb +1 -1
  9. data/app/controllers/caboose/block_types_controller.rb +1 -1
  10. data/app/controllers/caboose/calendars_controller.rb +1 -1
  11. data/app/controllers/caboose/cart_controller.rb +8 -1
  12. data/app/controllers/caboose/checkout_controller.rb +17 -9
  13. data/app/controllers/caboose/line_items_controller.rb +135 -0
  14. data/app/controllers/caboose/order_packages_controller.rb +304 -0
  15. data/app/controllers/caboose/orders_controller.rb +31 -74
  16. data/app/controllers/caboose/pages_controller.rb +2 -1
  17. data/app/controllers/caboose/product_images_controller.rb +11 -0
  18. data/app/controllers/caboose/products_controller.rb +25 -8
  19. data/app/controllers/caboose/shipping_addresses_controller.rb +46 -0
  20. data/app/controllers/caboose/shipping_packages_controller.rb +125 -54
  21. data/app/controllers/caboose/sites_controller.rb +2 -79
  22. data/app/controllers/caboose/smtp_controller.rb +52 -0
  23. data/app/controllers/caboose/store_controller.rb +94 -0
  24. data/app/controllers/caboose/vendors_controller.rb +25 -4
  25. data/app/models/caboose/address.rb +1 -3
  26. data/app/models/caboose/caboose_plugin.rb +1 -1
  27. data/app/models/caboose/category.rb +18 -0
  28. data/app/models/caboose/core_plugin.rb +21 -19
  29. data/app/models/caboose/order.rb +12 -7
  30. data/app/models/caboose/order_package.rb +5 -2
  31. data/app/models/caboose/order_transaction.rb +25 -0
  32. data/app/models/caboose/page.rb +1 -1
  33. data/app/models/caboose/schema.rb +50 -22
  34. data/app/models/caboose/shipping_calculator.rb +26 -30
  35. data/app/models/caboose/shipping_package.rb +45 -5
  36. data/app/models/caboose/store_config.rb +18 -6
  37. data/app/models/caboose/tax_calculator.rb +6 -5
  38. data/app/views/caboose/blocks/admin_edit.html.erb +1 -1
  39. data/app/views/caboose/line_items/admin_new.html.erb +100 -0
  40. data/app/views/caboose/orders/admin_edit.html.erb +21 -247
  41. data/app/views/caboose/orders/admin_edit_old.html.erb +155 -0
  42. data/app/views/caboose/orders/admin_new.html.erb +8 -23
  43. data/app/views/caboose/products/#Untitled-1# +0 -0
  44. data/app/views/caboose/products/admin_edit_images.html.erb +20 -4
  45. data/app/views/caboose/products/admin_index.html.erb +9 -3
  46. data/app/views/caboose/products/admin_sort.html.erb +138 -142
  47. data/app/views/caboose/roles/index.html.erb +1 -1
  48. data/app/views/caboose/shipping_packages/admin_edit.html.erb +52 -137
  49. data/app/views/caboose/shipping_packages/admin_index.html.erb +56 -19
  50. data/app/views/caboose/sites/_admin_header.html.erb +3 -5
  51. data/app/views/caboose/sites/admin_edit.html.erb +5 -3
  52. data/app/views/caboose/smtp/admin_edit.html.erb +41 -0
  53. data/app/views/caboose/station/index.html.erb +1 -1
  54. data/app/views/caboose/store/admin_edit.html.erb +96 -0
  55. data/app/views/caboose/vendors/admin_edit.html.erb +7 -3
  56. data/app/views/layouts/caboose/_station.html.erb +1 -1
  57. data/config/routes.rb +67 -25
  58. data/lib/caboose/engine.rb +1 -1
  59. data/lib/caboose/version.rb +1 -1
  60. metadata +28 -5
  61. data/app/views/caboose/shipping_packages/admin_new.html.erb +0 -33
  62. data/app/views/caboose/sites/admin_edit_smtp_config.html.erb +0 -51
  63. data/app/views/caboose/sites/admin_edit_store_config.html.erb +0 -77
@@ -0,0 +1,135 @@
1
+ module Caboose
2
+ class LineItemsController < Caboose::ApplicationController
3
+
4
+ # GET /admin/orders/:id/line-items/json
5
+ def admin_json
6
+ return if !user_is_allowed('orders', 'edit')
7
+ order = Order.find(params[:id])
8
+ render :json => order.line_items.as_json(:include => :order_package)
9
+ end
10
+
11
+ # GET /admin/orders/:order_id/line-items/new
12
+ def admin_new
13
+ return if !user_is_allowed('orders', 'edit')
14
+ render :layout => 'caboose/modal'
15
+ end
16
+
17
+ # POST /admin/orders/:order_id/line-items
18
+ def admin_add
19
+ return if !user_is_allowed('orders', 'edit')
20
+
21
+ resp = StdClass.new
22
+ v = Variant.find(params[:variant_id])
23
+ li = LineItem.new(
24
+ :order_id => params[:order_id],
25
+ :variant_id => params[:variant_id],
26
+ :quantity => 1,
27
+ :price => v.price,
28
+ :status => 'pending'
29
+ )
30
+ resp.success = li.save
31
+ render :json => resp
32
+ end
33
+
34
+ # PUT /admin/orders/:order_id/line-items/:id
35
+ def admin_update
36
+ return if !user_is_allowed('orders', 'edit')
37
+
38
+ resp = Caboose::StdClass.new({'attributes' => {}})
39
+ li = LineItem.find(params[:id])
40
+
41
+ save = true
42
+ send_status_email = false
43
+ params.each do |name,value|
44
+ case name
45
+ when 'order_id' then li.order_id = value
46
+ when 'order_package_id' then li.order_package_id = value
47
+ when 'variant_id' then li.variant_id = value
48
+ when 'parent_id' then li.parent_id = value
49
+ when 'price' then li.price = value
50
+ when 'notes' then li.notes = value
51
+ when 'custom1' then li.custom1 = value
52
+ when 'custom2' then li.custom2 = value
53
+ when 'custom3' then li.custom3 = value
54
+ when 'quantity'
55
+ li.quantity = value
56
+ li.save
57
+
58
+ # Recalculate everything
59
+ r = ShippingCalculator.rate(li.order, li.order.shipping_method_code)
60
+ li.order.shipping = r['negotiated_rate'] / 100
61
+ li.order.handling = (r['negotiated_rate'] / 100) * 0.05
62
+ tax_rate = TaxCalculator.tax_rate(li.order.shipping_address)
63
+ li.order.tax = li.order.subtotal * tax_rate
64
+ li.order.calculate_total
65
+ li.order.save
66
+
67
+ when 'tracking_number'
68
+ li.tracking_number = value
69
+ send_status_email = true
70
+ when 'status'
71
+ li.status = value
72
+ resp.attributes['status'] = {'text' => value}
73
+ send_status_email = true
74
+ end
75
+ end
76
+ if send_status_email
77
+ OrdersMailer.customer_status_updated(li.order).deliver
78
+ end
79
+ resp.success = save && li.save
80
+ render :json => resp
81
+ end
82
+
83
+ # DELETE /admin/orders/:order_id/line-items/:id
84
+ def admin_delete
85
+ return if !user_is_allowed('orders', 'delete')
86
+ li = LineItem.find(params[:id])
87
+ order = li.order
88
+ li.destroy
89
+ order.calculate_total
90
+ order.save
91
+ render :json => Caboose::StdClass.new({
92
+ :redirect => '/admin/orders'
93
+ })
94
+ end
95
+
96
+ # GET /admin/orders/:order_id/line-items/:id/highlight
97
+ def admin_highlight
98
+ return if !user_is_allowed('orders', 'view')
99
+ li = LineItem.find(params[:id])
100
+ v = li.variant
101
+ redirect_to "/admin/products/#{v.product_id}/variants?highlight=#{v.id}"
102
+ end
103
+
104
+ # GET /admin/orders/line-items/status-options
105
+ def admin_status_options
106
+ arr = ['pending', 'ready to ship', 'shipped', 'backordered', 'canceled']
107
+ options = []
108
+ arr.each do |status|
109
+ options << {
110
+ :value => status,
111
+ :text => status
112
+ }
113
+ end
114
+ render :json => options
115
+ end
116
+
117
+ # GET /admin/line-items/product-stubs
118
+ def admin_product_stubs
119
+ title = params[:title].strip.downcase.split(' ')
120
+ render :json => [] and return if title.length == 0
121
+ where = []
122
+ query = [""]
123
+ title.each do |str|
124
+ where << 'lower(title) like ?'
125
+ query << "%#{str}%"
126
+ end
127
+ where = where.join(' and ')
128
+ query[0] = "select id, title from store_products where #{where} order by title limit 20"
129
+ rows = ActiveRecord::Base.connection.select_rows(ActiveRecord::Base.send(:sanitize_sql_array, query))
130
+ arr = rows.collect{ |row| { :id => row[0], :title => row[1] }}
131
+ render :json => arr
132
+ end
133
+
134
+ end
135
+ end
@@ -0,0 +1,304 @@
1
+ module Caboose
2
+ class OrderPackagesController < Caboose::ApplicationController
3
+
4
+ # GET /admin/orders/:order_id/packages/json
5
+ def admin_json
6
+ return if !user_is_allowed('orders', 'view')
7
+ order = Order.find(params[:order_id])
8
+ render :json => order.packages.as_json(
9
+ :include => { :shipping_package => { :include => :shipping_methods} }
10
+ )
11
+ end
12
+
13
+ # POST /admin/orders/:order_id/packages
14
+ def admin_add
15
+ return if !user_is_allowed('orders', 'add')
16
+
17
+ resp = StdClass.new
18
+
19
+ if params[:shipping_package_id].strip.length == 0 then resp.error = "Please select a shipping package."
20
+ elsif params[:shipping_method_id].strip.length == 0 then resp.error = "Please select a shipping method."
21
+ else
22
+
23
+ op = OrderPackage.new(
24
+ :order_id => params[:order_id],
25
+ :shipping_package_id => params[:shipping_package_id],
26
+ :shipping_method_id => params[:shipping_method_id],
27
+ :status => OrderPackage::STATUS_PENDING
28
+ )
29
+ op.save
30
+ resp.new_id = op.id
31
+ resp.redirect = "/admin/orders/#{params[:order_id]}/packages/#{op.id}"
32
+
33
+ end
34
+
35
+ render :json => resp
36
+ end
37
+
38
+ # PUT /admin/orders/:order_id/packages/:id
39
+ def admin_update
40
+ return if !user_is_allowed('orders', 'edit')
41
+
42
+ resp = Caboose::StdClass.new
43
+ op = OrderPackage.find(params[:id])
44
+
45
+ save = true
46
+ params.each do |name,value|
47
+ case name
48
+ when 'order_id' then op.order_id = value
49
+ when 'shipping_method_id' then op.shipping_method_id = value
50
+ when 'shipping_package_id' then op.shipping_package_id = value
51
+ when 'status' then op.status = value
52
+ when 'tracking_number' then op.tracking_number = value
53
+ when 'total' then op.total = value
54
+ when 'package_method' then
55
+ arr = value.split('_')
56
+ op.shipping_package_id = arr[0]
57
+ op.shipping_method_id = arr[1]
58
+ end
59
+ end
60
+ op.order.calculate_total
61
+ resp.success = save && op.save
62
+ render :json => resp
63
+ end
64
+
65
+ # PUT /admin/orders/:order_id/line-items/:id
66
+ def admin_update_line_item
67
+ return if !user_is_allowed('orders', 'edit')
68
+
69
+ resp = Caboose::StdClass.new({'attributes' => {}})
70
+ li = LineItem.find(params[:id])
71
+
72
+ save = true
73
+ send_status_email = false
74
+ params.each do |name,value|
75
+ case name
76
+ when 'quantity'
77
+ li.quantity = value
78
+ li.save
79
+
80
+ # Recalculate everything
81
+ r = ShippingCalculator.rate(li.order, li.order.shipping_method_code)
82
+ li.order.shipping = r['negotiated_rate'] / 100
83
+ li.order.handling = (r['negotiated_rate'] / 100) * 0.05
84
+ tax_rate = TaxCalculator.tax_rate(li.order.shipping_address)
85
+ li.order.tax = li.order.subtotal * tax_rate
86
+ li.order.calculate_total
87
+ li.order.save
88
+
89
+ when 'tracking_number'
90
+ li.tracking_number = value
91
+ send_status_email = true
92
+ when 'status'
93
+ li.status = value
94
+ resp.attributes['status'] = {'text' => value}
95
+ send_status_email = true
96
+ end
97
+ end
98
+ if send_status_email
99
+ OrdersMailer.customer_status_updated(li.order).deliver
100
+ end
101
+ resp.success = save && li.save
102
+ render :json => resp
103
+ end
104
+
105
+ # DELETE /admin/orders/:order_id/packages/:id
106
+ def admin_delete
107
+ return if !user_is_allowed('orders', 'delete')
108
+ resp = StdClass.new
109
+ op = OrderPackage.find(params[:id])
110
+ if op.line_items.nil? || op.line_items.count == 0
111
+ op.destroy
112
+ resp.redirect = "/admin/orders/#{params[:order_id]}"
113
+ else
114
+ resp.error = "Only empty packages can be deleted."
115
+ end
116
+ render :json => resp
117
+ end
118
+
119
+ # GET /admin/orders/line-item-status-options
120
+ def admin_line_item_status_options
121
+ arr = ['pending', 'ready to ship', 'shipped', 'backordered', 'canceled']
122
+ options = []
123
+ arr.each do |status|
124
+ options << {
125
+ :value => status,
126
+ :text => status
127
+ }
128
+ end
129
+ render :json => options
130
+ end
131
+
132
+ # GET /admin/orders/:id/capture
133
+ def capture_funds
134
+ return if !user_is_allowed('orders', 'edit')
135
+
136
+ response = Caboose::StdClass.new({
137
+ 'refresh' => nil,
138
+ 'error' => nil,
139
+ 'success' => nil
140
+ })
141
+
142
+ order = Order.find(params[:id])
143
+
144
+ if order.financial_status == 'captured'
145
+ resp.error = "Funds for this order have already been captured."
146
+ elsif order.total > order.auth_amount
147
+ resp.error = "The order total exceeds the authorized amount."
148
+ else
149
+ if PaymentProcessor.capture(order)
150
+ order.update_attribute(:financial_status, 'captured')
151
+ response.success = 'Captured funds successfully'
152
+ else
153
+ response.error = 'Error capturing funds'
154
+ end
155
+
156
+ #if (order.discounts.any? && order.total < order.discounts.first.amount_current) || PaymentProcessor.capture(order)
157
+ # order.financial_status = 'captured'
158
+ # order.save
159
+ #
160
+ # if order.discounts.any?
161
+ # order.update_attribute(:amount_discounted, order.discounts.first.amount_current)
162
+ # order.update_gift_cards
163
+ # end
164
+ #
165
+ # response.success = "Captured funds successfully"
166
+ #else
167
+ # response.error = "Error capturing funds."
168
+ #end
169
+ end
170
+
171
+ render :json => response
172
+ end
173
+
174
+ # GET /admin/orders/:id/void
175
+ #def void
176
+ # return if !user_is_allowed('orders', 'edit')
177
+ #
178
+ # response = Caboose::StdClass.new({
179
+ # 'refresh' => nil,
180
+ # 'error' => nil,
181
+ # 'success' => nil
182
+ # })
183
+ #
184
+ # order = Order.find(params[:id])
185
+ #
186
+ # if order.financial_status == 'captured'
187
+ # response.error = "This order has already been captured, you will need to refund instead"
188
+ # else
189
+ # if order.total < order.amount_discounted || PaymentProcessor.void(order)
190
+ # order.financial_status = 'cancelled'
191
+ # order.status = 'voided'
192
+ # order.save
193
+ #
194
+ # response.success = "Order voided successfully"
195
+ # else
196
+ # response.error = "Error voiding order."
197
+ # end
198
+ # end
199
+ #
200
+ # render json: response
201
+ #end
202
+
203
+ # GET /admin/orders/:id/refund
204
+ # def refund
205
+ # return if !user_is_allowed('orders', 'edit')
206
+ #
207
+ # response = Caboose::StdClass.new({
208
+ # 'refresh' => nil,
209
+ # 'error' => nil,
210
+ # 'success' => nil
211
+ # })
212
+ #
213
+ # order = Order.find(params[:id])
214
+ #
215
+ # if order.financial_status != 'captured'
216
+ # response.error = "This order hasn't been captured yet, you will need to void instead"
217
+ # else
218
+ # ap order.total
219
+ # ap order.amount_discounted
220
+ #
221
+ # if order.total < order.amount_discounted || PaymentProcessor.refund(order)
222
+ # order.financial_status = 'refunded'
223
+ # order.status = 'refunded'
224
+ # order.save
225
+ #
226
+ # discount = order.discounts.first
227
+ # ap '==========================='
228
+ # ap order.amount_discounted + discount.amount_current
229
+ # ap '==========================='
230
+ # discount.update_attribute(:amount_current, order.amount_discounted + discount.amount_current) if order.discounts.any?
231
+ #
232
+ # response.success = "Order refunded successfully"
233
+ # else
234
+ # response.error = "Error refunding order."
235
+ # end
236
+ # end
237
+ #
238
+ # render json: response
239
+ # end
240
+
241
+ # GET /admin/orders/status-options
242
+ def admin_status_options
243
+ return if !user_is_allowed('categories', 'view')
244
+ statuses = ['cart', 'pending', 'ready to ship', 'shipped', 'canceled']
245
+ options = []
246
+ statuses.each do |s|
247
+ options << {
248
+ 'text' => s,
249
+ 'value' => s
250
+ }
251
+ end
252
+ render :json => options
253
+ end
254
+
255
+ # GET /admin/orders/test-info
256
+ def admin_mail_test_info
257
+ TestMailer.test_info.deliver
258
+ render :text => "Sent email to info@tuskwearcollection.com on #{DateTime.now.strftime("%F %T")}"
259
+ end
260
+
261
+ # GET /admin/orders/test-gmail
262
+ def admin_mail_test_gmail
263
+ TestMailer.test_gmail.deliver
264
+ render :text => "Sent email to william@nine.is on #{DateTime.now.strftime("%F %T")}"
265
+ end
266
+
267
+ # GET /admin/orders/google-feed
268
+ def admin_google_feed
269
+ d2 = DateTime.now
270
+ d1 = DateTime.now
271
+ if Caboose::Setting.exists?(:name => 'google_feed_date_last_submitted')
272
+ d1 = Caboose::Setting.where(:name => 'google_feed_date_last_submitted').first.value
273
+ d1 = DateTime.parse(d1)
274
+ elsif Order.exists?("status = 'shipped' and date_authorized is not null")
275
+ d1 = Order.where("status = ? and date_authorized is not null", 'shipped').reorder("date_authorized DESC").limit(1).pluck('date_authorized')
276
+ d1 = DateTime.parse(d1)
277
+ end
278
+
279
+ # Google Feed Docs
280
+ # https://support.google.com/trustedstoresmerchant/answer/3272612?hl=en&ref_topic=3272286?hl=en
281
+ tsv = ["merchant order id\ttracking number\tcarrier code\tother carrier name\tship date"]
282
+ if Order.exists?("status = 'shipped' and date_authorized > '#{d1.strftime("%F %T")}'")
283
+ Order.where("status = ? and date_authorized > ?", 'shipped', d1).reorder(:id).all.each do |order|
284
+ tracking_numbers = order.line_items.collect{ |li| li.tracking_number }.compact.uniq
285
+ tn = tracking_numbers && tracking_numbers.count >= 1 ? tracking_numbers[0] : ""
286
+ tsv << "#{order.id}\t#{tn}\tUPS\t\t#{order.date_shipped.strftime("%F")}"
287
+ end
288
+ end
289
+
290
+ # Save when we made the last call
291
+ setting = if Caboose::Setting.exists?(:name => 'google_feed_date_last_submitted')
292
+ Caboose::Setting.where(:name => 'google_feed_date_last_submitted').first
293
+ else
294
+ Caboose::Setting.new(:name => 'google_feed_date_last_submitted')
295
+ end
296
+
297
+ setting.value = d2.strftime("%F %T")
298
+ setting.save
299
+
300
+ # Print out the lines
301
+ render :text => tsv.join("\n")
302
+ end
303
+ end
304
+ end
@@ -27,10 +27,19 @@ module Caboose
27
27
 
28
28
  # GET /admin/orders/new
29
29
  def admin_new
30
- return if !user_is_allowed('orders', 'add')
31
- @products = Product.by_title
30
+ return if !user_is_allowed('orders', 'add')
32
31
  render :layout => 'caboose/admin'
33
32
  end
33
+
34
+ # POST /admin/orders
35
+ def admin_add
36
+ return if !user_is_allowed('orders', 'add')
37
+ order = Order.create(
38
+ :status => 'pending',
39
+ :financial_status => 'pending'
40
+ )
41
+ render :json => { :sucess => true, :redirect => "/admin/orders/#{order.id}" }
42
+ end
34
43
 
35
44
  # GET /admin/orders/:id
36
45
  def admin_edit
@@ -160,7 +169,19 @@ module Caboose
160
169
  def admin_json
161
170
  return if !user_is_allowed('orders', 'edit')
162
171
  order = Order.find(params[:id])
163
- render :json => order, :include => { :order_line_items => { :include => :variant }}
172
+ if order.shipping_address_id.nil?
173
+ sa = Address.create
174
+ order.shipping_address_id = sa.id
175
+ order.save
176
+ end
177
+ render :json => order.as_json(:include => [
178
+ { :line_items => { :include => { :variant => { :include => :product }}}},
179
+ { :order_packages => { :include => [:shipping_package, :shipping_method] }},
180
+ :customer,
181
+ :shipping_address,
182
+ :billing_address,
183
+ :order_transactions
184
+ ])
164
185
  end
165
186
 
166
187
  # GET /admin/orders/:id/print
@@ -185,17 +206,12 @@ module Caboose
185
206
  save = true
186
207
  params.each do |name,value|
187
208
  case name
188
- when 'tax'
189
- order.tax = value
190
- when 'shipping'
191
- order.shipping = value
192
- when 'handling'
193
- order.handling = value
194
- when 'discount'
195
- order.discount = value
196
- when 'status'
197
- order.status = value
198
- resp.attributes['status'] = {'text' => value}
209
+ when 'tax' then order.tax = value
210
+ when 'shipping' then order.shipping = value
211
+ when 'handling' then order.handling = value
212
+ when 'discount' then order.discount = value
213
+ when 'status' then order.status = value
214
+ when 'customer_id' then order.customer_id = value
199
215
  end
200
216
  end
201
217
  order.calculate_total
@@ -203,46 +219,6 @@ module Caboose
203
219
  render :json => resp
204
220
  end
205
221
 
206
- # PUT /admin/orders/:order_id/line-items/:id
207
- def admin_update_line_item
208
- return if !user_is_allowed('orders', 'edit')
209
-
210
- resp = Caboose::StdClass.new({'attributes' => {}})
211
- li = OrderLineItem.find(params[:id])
212
-
213
- save = true
214
- send_status_email = false
215
- params.each do |name,value|
216
- case name
217
- when 'quantity'
218
- li.quantity = value
219
- li.save
220
-
221
- # Recalculate everything
222
- r = ShippingCalculator.rate(li.order, li.order.shipping_method_code)
223
- li.order.shipping = r['negotiated_rate'] / 100
224
- li.order.handling = (r['negotiated_rate'] / 100) * 0.05
225
- tax_rate = TaxCalculator.tax_rate(li.order.shipping_address)
226
- li.order.tax = li.order.subtotal * tax_rate
227
- li.order.calculate_total
228
- li.order.save
229
-
230
- when 'tracking_number'
231
- li.tracking_number = value
232
- send_status_email = true
233
- when 'status'
234
- li.status = value
235
- resp.attributes['status'] = {'text' => value}
236
- send_status_email = true
237
- end
238
- end
239
- if send_status_email
240
- OrdersMailer.customer_status_updated(li.order).deliver
241
- end
242
- resp.success = save && li.save
243
- render :json => resp
244
- end
245
-
246
222
  # DELETE /admin/orders/:id
247
223
  def admin_delete
248
224
  return if !user_is_allowed('orders', 'delete')
@@ -252,19 +228,6 @@ module Caboose
252
228
  })
253
229
  end
254
230
 
255
- # GET /admin/orders/line-item-status-options
256
- def admin_line_item_status_options
257
- arr = ['pending', 'ready to ship', 'shipped', 'backordered', 'canceled']
258
- options = []
259
- arr.each do |status|
260
- options << {
261
- :value => status,
262
- :text => status
263
- }
264
- end
265
- render :json => options
266
- end
267
-
268
231
  # GET /admin/orders/:id/capture
269
232
  def capture_funds
270
233
  return if !user_is_allowed('orders', 'edit')
@@ -378,13 +341,7 @@ module Caboose
378
341
  def admin_status_options
379
342
  return if !user_is_allowed('categories', 'view')
380
343
  statuses = ['cart', 'pending', 'ready to ship', 'shipped', 'canceled']
381
- options = []
382
- statuses.each do |s|
383
- options << {
384
- 'text' => s,
385
- 'value' => s
386
- }
387
- end
344
+ options = statuses.collect{ |s| { 'text' => s, 'value' => s }}
388
345
  render :json => options
389
346
  end
390
347